Closed imanjra closed 3 months ago
The recent updates enhance the performance and functionality of the codebase. In the constants.ts
file, the PANEL_LOAD_TIMEOUT
constant is removed from the OPERATOR_PROMPT_AREAS
enum. The useSessionSpaces
hook is improved with a debouncing mechanism for the setSessionSpaces
function, using lodash's debounce
and React hooks (useCallback
and useMemo
). This ensures better performance during session space updates.
File | Summary |
---|---|
app/packages/operators/src/constants.ts |
Removed the PANEL_LOAD_TIMEOUT constant from the OPERATOR_PROMPT_AREAS enum. |
app/packages/state/src/hooks/useSessionSpaces.ts |
Added debouncing to setSessionSpaces function using lodash/debounce , useCallback , and useMemo for improved performance. |
sequenceDiagram
participant User
participant Component
participant Hook
participant setSessionSpacesDebounced
User->>Component: Interacts with session spaces
Component->>Hook: calls useSessionSpaces()
Hook->>setSessionSpacesDebounced: calls setSessionSpacesDebounced()
setSessionSpacesDebounced->>Session: Updates session spaces with debounce
In the code, a change takes flight,
Constants trimmed, the future's bright.
Session spaces, set with care,
Debouncing now, a lighter air.
Performance soars, efficiency gleams,
Our code now dances in swift dreams. 🌟
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?
What changes are proposed in this pull request?
Debounce updating session on spaces layout/state update to avoid per change session mutation requests
How is this patch tested? If it is not, please explain why.
Using a panel with a text input whose state is stored in persistent panel state
Release Notes
Is this a user-facing change that should be mentioned in the release notes?
(Details in 1-2 sentences. You can just refer to another PR with a description if this PR is part of a larger change.)
What areas of FiftyOne does this PR affect?
fiftyone
Python library changesSummary by CodeRabbit
Enhancements
useSessionSpaces
hook with debouncing to optimize performance when updating session spaces.Refactor
PANEL_LOAD_TIMEOUT
constant from the codebase.