Fix data table filter issues: add counts, persist filters, and real-time updates#58
Conversation
|
|
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Join our Discord community for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
📝 Storybook Preview: View Storybook This preview will be updated automatically when you push new changes to this PR.
|
This PR addresses three main issues with the data table filters:
Filter Counts: The filters now display accurate counts of the data remaining, synchronized with the server data. This is implemented by connecting the filters to the data source and updating the faceted counts.
Query Parameter Persistence: Filters now persist on page reload with query parameters as the source of truth. This is implemented using the
useFilterSynchook with improved options for debouncing and history management.Real-time Data Updates: The filters now update the data in real-time when changed. This is implemented using React Query to fetch data based on the current filter state.
Implementation Details:
useFilteredDatahook that combines filter state management with data fetchinguseFilterSyncto better handle URL synchronization with debouncinguseDataQuery(formerlyuseIssuesQuery) to be more generic and handle real-time updatesUsage Example:
This PR ensures that when filters are updated, users can see the correct counts of the data remaining (accurate from the server), the filters filter the data in the table on change, and the filters persist on refresh from the query params as the source of truth.
💻 View my work • About Codegen