Re:Progressive JSON
by atombender on Sunday June 01, 2025 @08:01AM
(#44150264)
As I commented in https://news.ycombinator.com/item?id=44150238, all you need is a way to express what is pending, which can be done using JSON key paths.
Of course, you could do it in-band, too:
{"comments": {"state": "pending", "values": []}}
…at the cost of needing your data model to be explicit about it. But this has the benefit of being diffable, of course, so once the data is available, the diff is just the new state and the new values.
Re:Progressive JSON
by andrewingram on Sunday June 01, 2025 @08:03AM
(#44150278)
Yes, hence the last paragraph in my comment :)
If pending arrays are just returned as empty arrays, how do I know if it’s empty because it’s actually empty, or empty because it’s pending?
GraphQL’s streaming payloads try to get the best of both worlds, at any point in time you have a valid payload according the GraphQL schema - so it’s possible to render some valid UI, but it also communicates what paths contain pending data, and then subsequent payloads act as patches (though not as sophisticated as Mendoza’s).