-
Notifications
You must be signed in to change notification settings - Fork 591
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
remove reload_on_navigation panel option #5018
Conversation
WalkthroughThe changes in this pull request primarily involve the removal of the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
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 using PR comments)
Other keywords and placeholders
Documentation and Community
|
dc01277
to
6e4f93b
Compare
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 and nitpick comments (2)
app/packages/spaces/src/components/Panel.tsx (1)
43-43
: Consider adding explicit type annotation for ComponentWhile the destructuring is correctly simplified, adding an explicit type annotation would improve type safety and documentation.
- const { component: Component } = panel; + const { component: Component }: { component: React.ComponentType<{panelNode: typeof node; dimensions: typeof dimensions}> } = panel;fiftyone/operators/operations.py (1)
335-335
: LGTM: Removal ofreload_on_navigation
parameter improves performanceThe removal of this parameter aligns with the PR objectives to eliminate navigation-based reloading, which was causing performance issues. This change encourages better resource management by plugin authors.
Plugin authors should now implement their own resource lifecycle management strategies, such as:
- Using React's
useEffect
for cleanup- Implementing explicit refresh mechanisms when needed
- Properly scoping subscriptions to component lifecycle
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (5)
app/packages/operators/src/Panel/register.tsx
(0 hunks)app/packages/plugins/src/index.ts
(0 hunks)app/packages/spaces/src/components/Panel.tsx
(3 hunks)fiftyone/operators/operations.py
(1 hunks)fiftyone/operators/panel.py
(0 hunks)
💤 Files with no reviewable changes (3)
- app/packages/operators/src/Panel/register.tsx
- app/packages/plugins/src/index.ts
- fiftyone/operators/panel.py
🧰 Additional context used
📓 Path-based instructions (1)
app/packages/spaces/src/components/Panel.tsx (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 (2)
app/packages/spaces/src/components/Panel.tsx (2)
4-4
: LGTM: Import changes align with functionality removal
The removal of useRecoilValue import while keeping useSetRecoilState is consistent with the elimination of modal unique ID subscription.
54-54
: LGTM: Improved component rendering pattern
The removal of the key prop is a positive change as it:
- Eliminates unnecessary remounts that were triggered by modal unique ID changes
- Relies on the proper React.memo implementation for optimization
- Maintains clean props passing with only essential dependencies
This change aligns well with React best practices and the PR's performance improvement goals.
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 🚀
Panel component subscribing to
fos.modalUniqueId
has negative performance consequences on the app, most importantly the sample modal plugin. This PR removes that.Motivation
Keying the panel component by "modal unique ID", which is a concatenation of sample and group id, leads to a slippery slope where the contract is not well-defined. This behavior was added to support
shouldReloadOnNavigation
panel option for modal panels, but what is "navigation" anyway? This gets tricky in dynamic groups of groups, for instance. Also,key=foo
is a bad react pattern.Removing this panel option also incentivizes the plugin author to write better code where they control the scope and maintain strict ownership of the resources they create / subscribe to, and their lifecycles.
Summary by CodeRabbit
Summary by CodeRabbit
New Features
reloadOnNavigation
property for future plugin functionality (commented out).Bug Fixes
reloadOnNavigation
option from various components and methods, streamlining the panel registration and rendering process.Refactor
Panel
component by eliminating unnecessary state dependencies and rendering logic.Documentation
reload_on_navigation
parameter in relevant classes and methods.