Skip to content
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

Merged
merged 1 commit into from Mar 25, 2024

Conversation

pranavxc
Copy link
Member

@pranavxc pranavxc commented Mar 22, 2024

Change Summary

Provide summary of changes with issue number if any.

Change type

  • feat: (new feature for the user, not a new feature for build script)
  • fix: (bug fix for the user, not a fix to a build script)
  • docs: (changes to the documentation)
  • style: (formatting, missing semi colons, etc; no production code change)
  • refactor: (refactoring production code, eg. renaming a variable)
  • test: (adding missing tests, refactoring tests; no production code change)
  • chore: (updating grunt tasks etc; no production code change)

Test/ Verification

Provide summary of changes.

Additional information / screenshots (optional)

Anything for maintainers to be made aware of

Summary by CodeRabbit

  • New Features
    • Introduced functionality to reset pagination and offset counts for linked and unlinked items lists upon certain conditions, enhancing user experience in navigating through items.
  • Refactor
    • Improved internal handling of pagination and list offsets to ensure smoother user interactions and data display.

@pranavxc pranavxc requested a review from mertmit March 22, 2024 10:55
Copy link
Contributor

coderabbitai bot commented Mar 22, 2024

Walkthrough

Walkthrough

The updates primarily focus on enhancing pagination and filter functionalities across different components in the nc-gui package. New functions have been introduced to reset pagination offset counts in specific scenarios, such as changes in filters. These improvements aim to ensure that the user interface remains responsive and accurate when navigating through lists of linked and unlinked items.

Changes

File Path Change Summary
.../virtual-cell/components/LinkedItems.vue Added resetChildrenListOffsetCount function; updated onFilterChange to reset pagination details.
.../virtual-cell/components/UnLinkedItems.vue Added call to resetChildrenExcludedOffsetCount(); updated onUnmounted hook.
.../composables/useLTARStore.ts Added resetChildrenListOffsetCount function; updated return object to include the new function.

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?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Commits Files that changed from the base of the PR and between bafc68e and d2036dc.
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 trigger onFilterChange 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 the onUnmounted 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 the onUnmounted 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 the onUnmounted 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 the childrenListOffsetCount. 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.

Copy link
Contributor

github-actions bot commented Mar 22, 2024

Uffizzi Preview deployment-48785 was deleted.

@pranavxc pranavxc merged commit f888191 into develop Mar 25, 2024
23 checks passed
@pranavxc pranavxc deleted the nc-fix/offset-in-links-modal branch March 25, 2024 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants