New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Reset offset count when closing modal or when filter query changes #7942
Conversation
WalkthroughWalkthroughThe updates primarily focus on enhancing pagination and filter functionalities across different components in the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (3)
- packages/nc-gui/components/virtual-cell/components/LinkedItems.vue (4 hunks)
- packages/nc-gui/components/virtual-cell/components/UnLinkedItems.vue (1 hunks)
- packages/nc-gui/composables/useLTARStore.ts (2 hunks)
Additional comments: 12
packages/nc-gui/components/virtual-cell/components/LinkedItems.vue (6)
- 62-62: The introduction of
resetChildrenListOffsetCount
is aligned with the PR's objective to manage offset counts effectively. This function is crucial for ensuring the UI's state remains consistent with user actions.- 74-77: Resetting the offset count when the modal closes is a good practice to ensure that stale data does not affect the user experience when the modal is reopened. This change is well-implemented.
- 216-216: Ensuring the offset count is reset upon component unmounting is a good cleanup practice, especially for SPA where component instances can be reused. This helps in avoiding potential bugs related to stale state.
- 221-225: The update to
onFilterChange
to reset both the pagination page and the offset count upon a filter change is crucial for maintaining accurate state in response to user actions. This change correctly addresses the PR's objectives.- 258-258: Using the
@change
event to triggeronFilterChange
ensures that the offset count is reset immediately when the filter query changes, which is a good practice for maintaining the UI's responsiveness and accuracy.- 258-258: The binding of
onFilterChange
to the@change
event in the template is correctly implemented, ensuring that the offset count reset logic is triggered as expected when the filter query changes.packages/nc-gui/components/virtual-cell/components/UnLinkedItems.vue (4)
- 259-259: Adding a call to
resetChildrenExcludedOffsetCount()
in theonUnmounted
lifecycle hook is a good practice for ensuring that the component's state is correctly reset upon unmounting. This helps in maintaining a clean state for SPA where components might be reused.- 259-259: Resetting the
childrenExcludedListPagination.query
alongside the offset count in theonUnmounted
lifecycle hook ensures that both the pagination state and the filter query are reset, which is important for maintaining the accuracy and relevance of the displayed items.- 259-259: Removing the event listener for
keydown
events in theonUnmounted
lifecycle hook is a crucial cleanup step to avoid potential memory leaks and ensure that event handlers do not persist beyond the lifecycle of the component.- 259-259: The binding of
onFilterChange
to the@change
event in the template is correctly implemented, ensuring that the offset count reset logic is triggered as expected when the filter query changes.packages/nc-gui/composables/useLTARStore.ts (2)
- 557-559: The addition of
resetChildrenListOffsetCount
function looks good. It's a straightforward implementation for resetting thechildrenListOffsetCount
. Ensure this function is called in the appropriate scenarios to effectively manage the offset count.- 591-592: The update to include
resetChildrenListOffsetCount
in the return object of the composable is correctly implemented. This ensures that the function is accessible to consumers of the composable.
Uffizzi Preview |
Change Summary
Provide summary of changes with issue number if any.
Change type
Test/ Verification
Provide summary of changes.
Additional information / screenshots (optional)
Anything for maintainers to be made aware of
Summary by CodeRabbit