-
Notifications
You must be signed in to change notification settings - Fork 595
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
Merge main to develop #4924
Merge main to develop #4924
Conversation
* move modal looker state to use-looker * fix video update sample * linting
* ID_LIKE fallback * bump db
Release/v1.0.1
WalkthroughThe pull request introduces several modifications across multiple components and files. Key changes include the simplification of state management in the Changes
Possibly related PRs
Suggested reviewers
Poem
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
|
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/core/src/components/ColorModal/ColorFooter.tsx (1)
17-17
: State management simplification is good, but consider adding a commentThe change from
useRecoilState
touseRecoilValue
foractiveColorModalField
is a good simplification of the state management. It makes the intent clearer that this component only reads this value.Consider adding a brief comment explaining why
activeColorModalField
is read-only in this component. This can help other developers understand the design decision quickly. For example:// activeColorModalField is read-only in this component as it's managed elsewhere const activeColorModalField = useRecoilValue(activeColorEntry);app/packages/looker/src/state.ts (1)
344-344
: LGTM! Consider adding JSDoc comment for clarity.The addition of the
buffers
property to theVideoState
interface is a good improvement for managing video buffer ranges. The use of theReadonly
type ensures immutability, which is excellent for state management.Consider adding a JSDoc comment to explain the purpose and structure of the
buffers
property. For example:/** * Represents the buffered ranges of the video. * Each element is a tuple of [start, end] in seconds. */ buffers: Buffers;This will enhance code readability and maintainability.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (7)
- app/packages/core/src/components/ColorModal/ColorFooter.tsx (3 hunks)
- app/packages/core/src/components/Modal/ModalLooker.tsx (2 hunks)
- app/packages/core/src/components/Modal/use-looker.ts (2 hunks)
- app/packages/looker/src/lookers/video.ts (6 hunks)
- app/packages/looker/src/state.ts (1 hunks)
- docs/source/release-notes.rst (2 hunks)
- package/db/setup.py (2 hunks)
✅ Files skipped from review due to trivial changes (1)
- docs/source/release-notes.rst
🧰 Additional context used
📓 Path-based instructions (5)
app/packages/core/src/components/ColorModal/ColorFooter.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.app/packages/core/src/components/Modal/ModalLooker.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.app/packages/core/src/components/Modal/use-looker.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/looker/src/lookers/video.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/looker/src/state.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 (21)
app/packages/core/src/components/Modal/ModalLooker.tsx (2)
4-5
: LGTM: Import cleanupThe removal of unused imports (
useCallback
,useEffect
,useState
, anduseRecoilState
) aligns with React best practices and improves code cleanliness.
30-30
: LGTM: Simplified ModalLookerNoTimeline componentThe changes in the
ModalLookerNoTimeline
component, including the removal of theuseEffect
hook and simplification of state management, align with React best practices. The component is now more focused and potentially more performant.Please verify that the removed functionality (setting modal looker state and managing
looker
andsetActiveLookerRef
effects) is not needed elsewhere in the application. Run the following script to check for any remaining usage:app/packages/core/src/components/ColorModal/ColorFooter.tsx (3)
6-6
: Import change looks goodThe import of
useRecoilValue
is consistent with the updated state management approach in this component. This change aligns well with React and Recoil best practices by using the most appropriate hook for read-only state.
Line range hint
1-153
: Overall, good simplification of state managementThe changes in this file represent a positive step towards simplifying state management in the
ColorFooter
component. The shift fromuseRecoilState
touseRecoilValue
foractiveColorModalField
is particularly noteworthy, as it clarifies the intent and potentially improves performance.However, there are a few areas where additional comments could improve code clarity:
- The purpose of the
useEffect
hook that setsactiveColorEntry
to null.- The rationale behind making
activeColorModalField
read-only in this component.These clarifications would greatly assist other developers in understanding the component's design and behavior.
28-29
: useEffect simplification is good, but needs clarificationThe simplification of the
useEffect
hook is a good change that aligns with the new state management approach. However, the purpose of this effect is not immediately clear.Could you please add a comment explaining the purpose of this effect? It would help other developers understand why we're setting
activeColorEntry
to null on component mount. Also, let's verify if this is the intended behavior:This will help us understand if setting it to null on mount is the correct approach or if we need to handle its lifecycle differently.
package/db/setup.py (3)
151-154
: Improved Linux distribution handlingThe changes to the
_get_linux_download
function enhance the flexibility of determining the appropriate download URL for Linux distributions. By first checking the distribution ID and then falling back toID_LIKE
, the script can now handle a wider range of Linux distributions more effectively. This improvement increases the robustness of the setup process across various Linux environments.
178-178
: Version number updatedThe package version has been incremented from 1.1.6 to 1.1.7. This minor version bump likely indicates small updates or bug fixes in the package.
Line range hint
1-324
: Overall assessment of changesThe changes in this pull request are focused and beneficial:
- The Linux distribution handling has been improved for better flexibility.
- The package version has been updated to 1.1.7.
These modifications enhance the script's robustness without introducing any apparent issues or unintended side effects. The overall structure and functionality of the setup script remain intact.
app/packages/core/src/components/Modal/use-looker.ts (6)
4-4
: ImportuseSetRecoilState
for state managementThe addition of
useSetRecoilState
from Recoil is appropriate for updating Recoil state within the component.
7-7
: IncludeuseModalContext
from hooksImporting
useModalContext
allows the component to access modal context functions likesetActiveLookerRef
, enhancing integration with the modal system.
106-106
: InitializesetModalLooker
using RecoilAssigning
setModalLooker
withuseSetRecoilState(fos.modalLooker)
correctly enables the component to update themodalLooker
state in Recoil.
108-108
: DestructuresetActiveLookerRef
from modal contextAccessing
setActiveLookerRef
viauseModalContext()
ensures the component can set the active looker reference within the modal context appropriately.
110-113
: Synchronize Recoil state withlooker
instanceThe
useEffect
hook updates themodalLooker
state wheneverlooker
changes, keeping the Recoil state in sync with the current looker instance.
114-118
: Update active looker reference whenlooker
is definedSetting the active looker reference in the modal context when
looker
is available ensures that dependent components have the correct reference.app/packages/looker/src/lookers/video.ts (7)
18-18
: ImportingVideoConfig
The addition of
VideoConfig
to the imports from"../state"
ensures that theVideoLooker
class has access to the necessary type definitions. This is appropriate.
322-322
: Refactoring buffer initializationBy initializing
buffers
usingthis.initialBuffers(config)
, the code improves modularity and avoids duplication. Encapsulating the buffer initialization logic in a separate method enhances maintainability.
332-333
: Using constants forpan
andscale
Defining
pan
andscale
as constants within thehasDefaultZoom
method enhances code clarity and ensures these values remain immutable during execution.
406-408
: Properly managing the video reader instanceThe addition of
lookerWithReader?.pause();
andthis.setReader();
ensures that when a newVideoLooker
instance takes over, the previous reader is paused, and resources are managed appropriately. This change helps prevent potential conflicts between multiple instances.
552-555
: ResettinglookerWithReader
during sample updateBy checking if
lookerWithReader === this
and resetting it inupdateSample
, the code ensures that the current reader is paused and references are cleared when updating the sample. This prevents resource leaks and ensures proper behavior when switching samples.
557-558
: Clearing frames and re-initializing buffersResetting
this.frames
to a newMap()
and re-initializingthis.state.buffers
withthis.initialBuffers(this.state.config)
ensures that the internal state is correctly reset when updating the sample. This is important for maintaining consistent state.
572-576
: AddinginitialBuffers
method for buffer initializationThe new private method
initialBuffers(config: VideoConfig)
encapsulates the logic for initializingbuffers
. This improves code reusability and maintainability by centralizing buffer initialization used in multiple places.
What changes are proposed in this pull request?
merge post-release main to develop
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
fiftyone quickstart
andfiftyone app launch
commands.Documentation
Chores
fiftyone-db
package from 1.1.6 to 1.1.7.