-
Notifications
You must be signed in to change notification settings - Fork 587
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 dynamic group player for group datasets #4479
Conversation
WalkthroughThe recent changes enhance the dynamic group handling functionality by incorporating a Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Hook as useCreateLooker Hook
participant Recoil as Recoil State
participant Selector as dynamicGroupPageSelector
User->>Hook: Call useCreateLooker(isModal)
Hook->>Recoil: Fetch dynamic group state
Recoil->>Selector: Call dynamicGroupPageSelector with { value, modal }
Selector-->>Recoil: Return filtered group state
Recoil-->>Hook: Provide group state
Hook-->>User: Return looker with group state
Poem
Warning Review ran into problemsProblems (1)
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.
Actionable comments posted: 1
Outside diff range and nitpick comments (1)
app/packages/state/src/recoil/dynamicGroups.test.ts (1)
5-9
: Ensure consistent import grouping and separation.Consider grouping related imports together and separating them with a blank line for better readability. For example, group all imports from
recoil
together.
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (3)
- app/packages/state/src/hooks/useCreateLooker.ts (2 hunks)
- app/packages/state/src/recoil/dynamicGroups.test.ts (2 hunks)
- app/packages/state/src/recoil/dynamicGroups.ts (2 hunks)
Additional context used
Path-based instructions (3)
app/packages/state/src/recoil/dynamicGroups.test.ts (1)
Pattern
**/*.{ts,tsx}
: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.app/packages/state/src/recoil/dynamicGroups.ts (1)
Pattern
**/*.{ts,tsx}
: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.app/packages/state/src/hooks/useCreateLooker.ts (1)
Pattern
**/*.{ts,tsx}
: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.
Additional comments not posted (4)
app/packages/state/src/recoil/dynamicGroups.test.ts (1)
Line range hint
12-58
: Updated test suite description and added new test cases.The renaming of the test suite and the addition of new test cases for
modalPageSelector
andpageSelector
are appropriate for the expanded functionality. Ensure that these tests cover all new logic paths introduced by the changes.app/packages/state/src/recoil/dynamicGroups.ts (1)
9-14
: Updated imports to include new group slices.The addition of
groupSlice
andmodalGroupSlice
to the imports is necessary for the new functionality. Ensure these are used appropriately throughout the module.app/packages/state/src/hooks/useCreateLooker.ts (2)
191-194
: UpdateddynamicGroupPageSelector
call to includemodal
parameter.The inclusion of the
modal
parameter in thedynamicGroupPageSelector
call aligns with the PR's objectives to fix issues related to modal contexts in dynamic group datasets. This change is crucial for ensuring the correct functionality in different modal states.
261-261
: Ensure dependencies are correctly listed inuseRecoilCallback
.#!/bin/bash # Description: Verify that all dependencies used in the `useRecoilCallback` are listed in the dependency array. # Test: Search for usage of variables inside `useRecoilCallback`. Expect: All used variables are listed in the dependency array. rg --type typescript $'useRecoilCallback' -A 30 | grep -E 'get|snapshot'Ensure that all variables used inside the
useRecoilCallback
are listed in the dependency array to avoid stale closures and ensure the hook behaves as expected.
filter: { group: { slice?: string } }; | ||
view: State.Stage[]; | ||
}, | ||
string | ||
{ modal: boolean; value: string } | ||
>({ | ||
key: "paginateDynamicGroupVariables", | ||
get: | ||
(value) => | ||
({ modal, value }) => | ||
({ get }) => { | ||
const params = { | ||
dataset: get(datasetName), | ||
view: get(dynamicGroupViewQuery(value)), | ||
filter: { group: { slice: get(modal ? modalGroupSlice : groupSlice) } }, |
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.
Refactored dynamicGroupPageSelector
to handle modal contexts.
The refactoring of dynamicGroupPageSelector
to include a modal context is a significant improvement. Consider adding more detailed comments explaining the logic, especially how the modal flag affects the slice selection, to aid future maintainability.
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.
🎸
lgtm!!!
What changes are proposed in this pull request?
Adds missing
slice
parameter to imavid paginationHow is this patch tested? If it is not, please explain why.
Selector tests for
dynamicGroupPageSelector
Release Notes
What areas of FiftyOne does this PR affect?
fiftyone
Python library changesSummary by CodeRabbit
New Features
Tests