-
Notifications
You must be signed in to change notification settings - Fork 552
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 modal linking #4618
Fix modal linking #4618
Conversation
Warning Rate limit exceeded@benjaminpkane has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 20 minutes and 46 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThe recent changes enhance the modularity and flexibility of the application by updating various components to manage identifiers and state more effectively. Key modifications include renaming properties for consistency, reorganizing module exports, and introducing new resolver functions. These adjustments improve data handling across different contexts, ultimately streamlining the application's functionality and maintainability. Changes
Sequence Diagram(s)sequenceDiagram
participant A as User
participant B as Modal
participant C as DatasetManager
participant D as Loader
A->>B: Open Modal
B->>C: Request Datasets
C->>D: Load Datasets
D-->>C: Return Datasets
C-->>B: Provide Datasets
B-->>A: Display Modal with Datasets
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 Configuration 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: 0
Outside diff range, codebase verification and nitpick comments (1)
app/packages/utilities/src/index.ts (1)
699-699
: Issue Found: Unreachable Code inenv
FunctionThe
env
function inapp/packages/utilities/src/index.ts
contains two return statements, making the second one unreachable. The current implementation will always return{ VITE_NO_STATE: true }
. The second return statement (return import.meta.env;
) should be removed or the function logic should be corrected.
- File:
app/packages/utilities/src/index.ts
- Lines: 699-699
- Code:
return { VITE_NO_STATE: true }; return import.meta.env;Please revise the function to ensure it returns the intended value.
Analysis chain
LGTM! Verify the behavior of the env function.
The changes to the
env
function are approved.Ensure that the function behaves as expected with the new default value.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the behavior of the env function. # Test: Search for the usage of env function. Expect: Correct behavior with new default value. rg --type ts 'env\(\)'Length of output: 1048
Script:
#!/bin/bash # Description: Locate the implementation of the env function and inspect its code. # Locate the implementation of the env function rg --type ts 'function env' -A 10Length of output: 35
Script:
#!/bin/bash # Description: Locate the definition of the env function or variable. # Search for the definition of `env` as a function, variable, or export rg --type ts 'env\s*[:=]' -A 10Length of output: 2200
Script:
#!/bin/bash # Description: Inspect the full implementation of the env function in `app/packages/utilities/src/index.ts`. # Display the full implementation of the env function rg --type ts -A 20 'export const env' app/packages/utilities/src/index.tsLength of output: 609
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (8)
- app/packages/app/src/useEventSource.ts (1 hunks)
- app/packages/app/src/useEvents/useStateUpdate.ts (1 hunks)
- app/packages/app/src/useEvents/utils.ts (2 hunks)
- app/packages/app/src/useSetters/onSetDataset.ts (1 hunks)
- app/packages/utilities/src/index.ts (2 hunks)
- e2e-pw/src/oss/fixtures/loader.ts (3 hunks)
- e2e-pw/src/oss/specs/modal/linking.spec.ts (1 hunks)
- e2e-pw/src/shared/abstract-loader.ts (1 hunks)
Additional context used
Path-based instructions (8)
e2e-pw/src/shared/abstract-loader.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/app/src/useEvents/useStateUpdate.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/app/src/useSetters/onSetDataset.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.e2e-pw/src/oss/specs/modal/linking.spec.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/app/src/useEventSource.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/app/src/useEvents/utils.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.e2e-pw/src/oss/fixtures/loader.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/utilities/src/index.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 (21)
e2e-pw/src/shared/abstract-loader.ts (1)
11-13
: Ensure proper usage ofURLSearchParams
.The change from
savedView
tosearchParams
enhances flexibility. Ensure that any usage ofWaitUntilGridVisibleOptions
correctly handlesURLSearchParams
.Verification successful
Proper usage of
URLSearchParams
verified.The
searchParams
property in theWaitUntilGridVisibleOptions
type is correctly handled as an instance ofURLSearchParams
in thee2e-pw/src/oss/fixtures/loader.ts
file.
searchParams
is converted to a string and appended to a URL.- The
get
method is called onsearchParams
to retrieve parameter values.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify correct usage of the updated `WaitUntilGridVisibleOptions` type. # Test: Search for the usage of `WaitUntilGridVisibleOptions`. Expect: Correct handling of `URLSearchParams`. rg --type ts -A 5 $'WaitUntilGridVisibleOptions'Length of output: 1415
Script:
#!/bin/bash # Description: Verify proper handling of `searchParams` as `URLSearchParams` in `e2e-pw/src/oss/fixtures/loader.ts`. # Test: Search for the usage of `searchParams` in `e2e-pw/src/oss/fixtures/loader.ts`. rg --type ts 'searchParams' -A 10 e2e-pw/src/oss/fixtures/loader.tsLength of output: 1217
app/packages/app/src/useEvents/useStateUpdate.ts (1)
32-33
: Ensure consistency in identifier usage.The change from
sampleId
toid
and the conditional logic forslice
enhances flexibility. Verify that all references tosampleId
have been updated toid
and that the conditional logic is correctly implemented.app/packages/app/src/useSetters/onSetDataset.ts (1)
51-51
: Ensure consistency in identifier usage.The change from
sampleId
toid
aims to streamline the identification process. Verify that all references tosampleId
have been updated toid
.e2e-pw/src/oss/specs/modal/linking.spec.ts (4)
1-9
: LGTM!The
test
function extension to include amodal
fixture is well-structured and follows best practices for Playwright testing.
16-39
: LGTM!The
beforeAll
hook correctly sets up the datasets and samples for the tests usingfiftyoneLoader
.
41-50
: LGTM!The
sample linking
test correctly verifies the functionality by waiting for the grid, checking the modal state, and verifying the sidebar entry.
52-61
: LGTM!The
group linking
test correctly verifies the functionality by waiting for the grid, checking the modal state, and verifying the sidebar entry.app/packages/app/src/useEventSource.ts (1)
61-61
: Verify the correctness of the parameter change.The
sample_id
parameter now usesgetParam("id")
instead ofgetParam("sampleId")
. Ensure that this change aligns with the intended functionality and thatgetParam("id")
retrieves the correct value.Verification successful
The change from
getParam("sampleId")
togetParam("id")
is correct and aligns with the intended functionality.The usage of
getParam("id")
is consistent with other parts of the codebase, confirming its validity.
app/packages/app/src/useEventSource.ts
app/packages/app/src/useEvents/utils.ts
app/packages/app/src/useEvents/useStateUpdate.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `getParam("id")` in the codebase. # Test: Search for the usage of `getParam("id")`. Expect: Correct usage in relevant contexts. rg --type js --type ts -A 5 $'getParam("id")'Length of output: 46
Script:
#!/bin/bash # Description: Verify the definition and usage of `getParam` in the codebase. # Search for the definition of the `getParam` function. rg 'function getParam' -A 5 # Search for all usages of the `getParam` function. rg 'getParam(' -A 5Length of output: 120
Script:
#!/bin/bash # Description: Verify the definition and usage of `getParam` in the codebase. # Search for the definition of the `getParam` function. rg 'function getParam' -A 5 # Search for all usages of the `getParam` function. rg 'getParam\(' -A 5Length of output: 2496
app/packages/app/src/useEvents/utils.ts (8)
Line range hint
10-49
:
LGTM!The
processState
function is well-structured and the use of resolver functions enhances modularity and readability.
52-58
: LGTM!The
resolveSelected
function correctly handles theVITE_NO_STATE
condition and returns a set of selected items.
60-69
: LGTM!The
resolveSelectedLabels
function correctly handles theVITE_NO_STATE
condition and returns an array of selected labels.
71-79
: LGTM!The
resolveFieldVisibility
function correctly handles theVITE_NO_STATE
condition and returns the field visibility state.
81-87
: LGTM!The
resolveGroupSlice
function correctly handles theVITE_NO_STATE
condition and returns the group slice state.
89-106
: LGTM!The
resolveModalSelector
function correctly handles theVITE_NO_STATE
condition and returns the modal selector state.
108-114
: LGTM!The
resolveView
function correctly handles theVITE_NO_STATE
condition and returns the view state.
116-125
: LGTM!The
resolveWorkspace
function correctly handles theVITE_NO_STATE
condition and returns the workspace state.e2e-pw/src/oss/fixtures/loader.ts (4)
132-132
: Ensure proper handling of dataset selection.The method
forceDatasetFromSelector
correctly handles dataset selection.Verify that this logic works as expected in all scenarios.
144-146
: LGTM! Verify the URL construction logic.The URL construction logic using
searchParams
is approved.Ensure that the URL is constructed correctly in all scenarios.
156-161
: Ensure proper validation of view parameter.The validation logic for the
view
parameter is correct.Verify that the view parameter is validated correctly in all scenarios.
124-126
: LGTM! Verify the usage of new options.The constructor changes are approved.
Ensure that the new options
isEmptyDataset
,searchParams
, andwithGrid
are used correctly throughout the class.app/packages/utilities/src/index.ts (1)
11-13
: LGTM! Verify the exports.The reorganization of exports is approved.
Ensure that the
Resource
andorder
modules are exported correctly.Verification successful
Verified: The exports for
Resource
andorder
modules are correctly set up.
index.ts
correctly exports from./order
and./Resource
.Resource/index.ts
correctly exportsResource
andcreateResourceGroup
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the exports of Resource and order modules. # Test: Search for the exports in the index.ts file. Expect: Correct export statements. rg --type ts 'export.*from.*"./Resource"|export.*from.*"./order"'Length of output: 308
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: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (4)
- e2e-pw/src/oss/specs/groups/dynamic-groups.spec.ts (2 hunks)
- e2e-pw/src/oss/specs/groups/sparse-dynamic-groups.spec.ts (1 hunks)
- e2e-pw/src/oss/specs/regression-tests/grid-page.spec.ts (1 hunks)
- e2e-pw/src/oss/specs/smoke-tests/quickstart-groups-dynamic.spec.ts (1 hunks)
Additional context used
Path-based instructions (4)
e2e-pw/src/oss/specs/smoke-tests/quickstart-groups-dynamic.spec.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.e2e-pw/src/oss/specs/regression-tests/grid-page.spec.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.e2e-pw/src/oss/specs/groups/dynamic-groups.spec.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.e2e-pw/src/oss/specs/groups/sparse-dynamic-groups.spec.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 (5)
e2e-pw/src/oss/specs/smoke-tests/quickstart-groups-dynamic.spec.ts (1)
57-58
: Enhanced parameter handling forwaitUntilGridVisible
.The change from
savedView
tosearchParams
usingURLSearchParams
improves the flexibility and clarity of the parameters passed towaitUntilGridVisible
. This structured approach is beneficial for future expansions.e2e-pw/src/oss/specs/regression-tests/grid-page.spec.ts (1)
72-73
: Improved parameter handling forwaitUntilGridVisible
.The change from
savedView
tosearchParams
usingURLSearchParams
enhances the flexibility and clarity of the parameters passed towaitUntilGridVisible
. This structured approach is beneficial for future expansions.e2e-pw/src/oss/specs/groups/dynamic-groups.spec.ts (2)
57-58
: Enhanced parameter handling forwaitUntilGridVisible
.The change from
savedView
tosearchParams
usingURLSearchParams
improves the flexibility and clarity of the parameters passed towaitUntilGridVisible
. This structured approach is beneficial for future expansions.
77-78
: Improved parameter handling forwaitUntilGridVisible
.The change from
savedView
tosearchParams
usingURLSearchParams
enhances the flexibility and clarity of the parameters passed towaitUntilGridVisible
. This structured approach is beneficial for future expansions.e2e-pw/src/oss/specs/groups/sparse-dynamic-groups.spec.ts (1)
90-91
: Verify the correctness of the new parameter usage.The change from
savedView: "group"
tosearchParams: new URLSearchParams({ view: "group" })
is intended to facilitate additional query parameters. Ensure that this new parameter is correctly handled by thewaitUntilGridVisible
function and that it does not break existing functionality.Verification successful
Verify the correctness of the new parameter usage.
The change from
savedView: "group"
tosearchParams: new URLSearchParams({ view: "group" })
is correctly handled by thewaitUntilGridVisible
function, as it processessearchParams
within its options parameter.
e2e-pw/src/oss/fixtures/loader.ts
: ThewaitUntilGridVisible
function handlessearchParams
correctly.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the `waitUntilGridVisible` function correctly handles the `searchParams` parameter. # Test: Search for the function definition and ensure it handles `searchParams`. rg --type python -A 5 $'def waitUntilGridVisible'Length of output: 81
Script:
#!/bin/bash # Description: Verify that the `waitUntilGridVisible` function correctly handles the `searchParams` parameter. # Test: Search for the function definition in TypeScript/JavaScript files and ensure it handles `searchParams`. rg --type js -A 10 'function waitUntilGridVisible'Length of output: 52
Script:
#!/bin/bash # Description: Verify that the `waitUntilGridVisible` function correctly handles the `searchParams` parameter. # Test: Search for the function definition in TypeScript/JavaScript files and ensure it handles `searchParams`. rg --type-add 'ts:*.ts' --type-add 'js:*.js' -A 10 'function waitUntilGridVisible' rg --type-add 'ts:*.ts' --type-add 'js:*.js' -A 10 'waitUntilGridVisible =' rg --type-add 'ts:*.ts' --type-add 'js:*.js' -A 10 'waitUntilGridVisible:'Length of output: 237
Script:
#!/bin/bash # Description: Verify that the `waitUntilGridVisible` function correctly handles the `searchParams` parameter. # Test: Search for any references to `waitUntilGridVisible` across all file types. rg -A 10 'waitUntilGridVisible'Length of output: 46068
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. From local testing, i noticed when going to a group modal URL, slice is added as param. However, it does not update when switching between the slice in UI. Is that intentional?
It's an unfortunate side effect of the event source 🤦, will try to follow up |
What changes are proposed in this pull request?
Fixes sample
id
and groupgroupId
direct linking in the AppHow is this patch tested? If it is not, please explain why.
New e2e spec
What areas of FiftyOne does this PR affect?
fiftyone
Python library changesSummary by CodeRabbit
New Features
id
instead ofsampleId
across various functions.Bug Fixes
Documentation
Chores