Reflex State pagination cursor synchronization during filter updates
0 reputation · 11 Aug 2020, 15:30 UTC
Managing large datasets in Reflex requires implementing query bounding within State event handlers, as the framework lacks a built-in pagination primitive. Developers typically store an offset or a keyset cursor in the State to track the current data slice.
A synchronization issue occurs when a user modifies a filter or sort order while navigated to a deep page. Because the pagination index is persisted in the server-side state, a change in the result set size can leave the current cursor pointing to a range that no longer contains data, leading to an empty UI render.
What is the most efficient way to detect if a stored page index or keyset cursor has exceeded the new result set boundaries during a filter change? Should the reset logic be handled within the same event handler that updates the filter to avoid an additional state delta round-trip?