erquhart
erquhart8mo ago

Graceful error handling in paginated queries

Scenario: - We have a one-to-many relationship, many Bars to one Foo - A user is viewing a paginated list of Bars from a Foo id in the url path - A different user deletes the Foo in question I expect the change will cause the paginated query to rerun, as the Foo id is an arg for the query. Is there any problem with returning a fake paginated query result so the list just renders empty? There will be more that happens to gracefully navigate away, but not before that paginated query throws. I want to avoid using error boundaries for fully expected errors like this. Fake paginated query result I'm using:
export const emptyPaginatedQueryResult = {
page: [],
isDone: true,
continueCursor: '',
}
export const emptyPaginatedQueryResult = {
page: [],
isDone: true,
continueCursor: '',
}
2 Replies
lee
lee8mo ago
No problem, go ahead. I think we have a proposal internally to export this "empty page" as a constant
erquhart
erquhartOP8mo ago
Beautiful, thanks!

Did you find this page helpful?