Skip to content
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

fixes and enhancements for modal spaces #4771

Merged
merged 2 commits into from
Sep 16, 2024
Merged

Conversation

imanjra
Copy link
Contributor

@imanjra imanjra commented Sep 5, 2024

What changes are proposed in this pull request?

fixes and enhancements for modal spaces

How is this patch tested? If it is not, please explain why.

Using spaces in sample modal

Release Notes

Is this a user-facing change that should be mentioned in the release notes?

  • No. You can skip the rest of this section.
  • Yes. Give a description of this change to be included in the release
    notes for FiftyOne users.

(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?

  • App: FiftyOne application changes
  • Build: Build and test infrastructure changes
  • Core: Core fiftyone Python library changes
  • Documentation: FiftyOne documentation changes
  • Other

Summary by CodeRabbit

  • New Features

    • Enhanced modal responsiveness with dynamic height adjustments for improved layout.
    • Improved sidebar behavior in modal contexts to prevent overflow.
    • Streamlined handling of modal states for better performance and clarity in the AddPanelButton component.
    • Added a new icon to the modal sample plugin for improved visual representation.
    • Enhanced functionality of the Panel component with state management for panel IDs and scopes.
    • Introduced new hooks for better panel state management, allowing for contextualized control.
  • Style

    • Simplified CSS styling for the ActionsRow component, promoting a cleaner design.
    • Adjusted height specifications for the Arrow component in modal navigation for better adaptability.
    • Removed conditional styling for StyledElements to ensure consistent layout.

Copy link
Contributor

coderabbitai bot commented Sep 5, 2024

Walkthrough

The changes involve updates to several components, focusing on CSS styling adjustments, modal handling logic, and state management enhancements. Key modifications include the removal of redundant CSS rules in the ActionsRow and Sidebar components, dynamic height calculations for the Modal, and improvements in modal state management in the AddPanelButton. Additionally, the PanelTabs component's height is now fixed for modal instances, and a new icon has been integrated into the modal sample plugin.

Changes

Files Change Summary
app/packages/core/src/components/Actions/ActionsRow.tsx
app/packages/core/src/components/Sidebar/Sidebar.tsx
Removal of several CSS styling rules to simplify design and enhance responsiveness, particularly in modal contexts.
app/packages/core/src/components/Modal/Modal.tsx Update of the screenParams object for dynamic height adjustment when the modal is not in full-screen mode.
app/packages/spaces/src/components/AddPanelButton.tsx Refactor of modal state handling logic to use useRecoilValue, improving performance and clarity, along with a streamlined panelsPredicate function.
app/packages/spaces/src/components/StyledElements.tsx Removal of conditional logic for height in PanelTabs and StyledPanel, leading to a fixed height for modal instances.
app/packages/core/src/plugins/modal-sample.tsx Addition of the ViewInAr icon to the registerComponent function, enhancing the visual representation of the modal sample plugin.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Modal
    participant Sidebar
    participant AddPanelButton

    User->>Modal: Open Modal
    Modal->>Sidebar: Check modal state
    Sidebar->>Modal: Apply conditional styles
    User->>AddPanelButton: Interact with button
    AddPanelButton->>Modal: Check modal state
    AddPanelButton->>User: Update UI based on modal state
Loading

Poem

In the meadow where rabbits play,
Changes hop along the way.
Styles are trimmed, heights adjusted,
Modal magic, all trusted.
With a twitch and a bound,
New designs abound! 🐇✨


Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between aa52d50 and fca64f6.

Files selected for processing (16)
  • app/packages/core/src/components/Actions/ActionsRow.tsx (1 hunks)
  • app/packages/core/src/components/Modal/Modal.tsx (3 hunks)
  • app/packages/core/src/components/Modal/ModalNavigation.tsx (1 hunks)
  • app/packages/core/src/components/Modal/ModalSamplePlugin.tsx (4 hunks)
  • app/packages/core/src/components/Sidebar/Sidebar.tsx (1 hunks)
  • app/packages/core/src/plugins/SchemaIO/components/DashboardView.tsx (2 hunks)
  • app/packages/core/src/plugins/modal-sample.tsx (2 hunks)
  • app/packages/operators/src/built-in-operators.ts (1 hunks)
  • app/packages/operators/src/useCustomPanelHooks.ts (3 hunks)
  • app/packages/spaces/src/components/AddPanelButton.tsx (2 hunks)
  • app/packages/spaces/src/components/Panel.tsx (3 hunks)
  • app/packages/spaces/src/components/StyledElements.tsx (1 hunks)
  • app/packages/spaces/src/contexts.ts (1 hunks)
  • app/packages/spaces/src/hooks.ts (7 hunks)
  • app/packages/spaces/src/state.ts (2 hunks)
  • app/packages/spaces/src/types.ts (1 hunks)
Files skipped from review as they are similar to previous changes (14)
  • app/packages/core/src/components/Actions/ActionsRow.tsx
  • app/packages/core/src/components/Modal/Modal.tsx
  • app/packages/core/src/components/Modal/ModalNavigation.tsx
  • app/packages/core/src/components/Modal/ModalSamplePlugin.tsx
  • app/packages/core/src/components/Sidebar/Sidebar.tsx
  • app/packages/core/src/plugins/SchemaIO/components/DashboardView.tsx
  • app/packages/core/src/plugins/modal-sample.tsx
  • app/packages/operators/src/useCustomPanelHooks.ts
  • app/packages/spaces/src/components/AddPanelButton.tsx
  • app/packages/spaces/src/components/Panel.tsx
  • app/packages/spaces/src/components/StyledElements.tsx
  • app/packages/spaces/src/contexts.ts
  • app/packages/spaces/src/state.ts
  • app/packages/spaces/src/types.ts
Additional context used
Path-based instructions (2)
app/packages/spaces/src/hooks.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/operators/src/built-in-operators.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 (9)
app/packages/spaces/src/hooks.ts (7)

249-250: LGTM!

The addition of the scope parameter to the usePanelState function enhances the flexibility and functionality of the panel state management system by allowing developers to specify a scope for more contextualized state management.


263-264: LGTM!

The addition of the scope parameter to the useSetPanelStateById function is consistent with the changes made to the usePanelState function and enhances the flexibility and functionality of the panel state management system.


305-306: LGTM!

The addition of the scope parameter to the usePanelStateCallback function is consistent with the changes made to the other panel state management functions and enhances the flexibility and functionality of the system.


325-326: LGTM!

The addition of the scope parameter to the usePanelStateByIdCallback function is consistent with the changes made to the other panel state management functions and enhances the flexibility and functionality of the system.


346-347: LGTM!

The addition of the scope parameter to the usePanelStateLazy function is consistent with the changes made to the other panel state management functions and enhances the flexibility and functionality of the system.


371-372: LGTM!

The addition of the scope parameter to the usePanelStatePartial function is consistent with the changes made to the other panel state management functions and enhances the flexibility and functionality of the system.


457-462: LGTM!

The introduction of the useScope function centralizes the logic for determining the scope, ensuring consistency across the modified functions that use the scope parameter. This is a good practice to avoid code duplication and maintain a single source of truth for the scope determination logic.

app/packages/operators/src/built-in-operators.ts (2)

14-14: LGTM!

The import changes look good. The removal of usePanelState and addition of setPathUserUnchanged align with the refactoring effort to reduce dependencies on the panel state.


Line range hint 1001-1003: Looks good!

The refactoring of the useHooks method in the PromptUserForOperation class to remove the dependency on the panel state is a positive change. It simplifies the logic, improves modularity, and focuses on event-driven interactions.


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, please review it.
    -- Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    -- @coderabbitai generate unit testing code for this file.
    -- @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    -- @coderabbitai generate interesting stats about this repository and render them as a table.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    -- @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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/core/src/components/Sidebar/Sidebar.tsx (1)

736-736: Conditional styling based on modal prop is well-implemented.

The conditional styling logic correctly adjusts the sidebar's maximum height based on the modal prop. However, the specific value "28px" used in the calculation seems arbitrary without context. It would be beneficial to add a comment explaining why this particular value is used, to aid future maintainability.

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between abf92e2 and da37796.

Files selected for processing (5)
  • app/packages/core/src/components/Actions/ActionsRow.tsx (1 hunks)
  • app/packages/core/src/components/Modal/Modal.tsx (1 hunks)
  • app/packages/core/src/components/Sidebar/Sidebar.tsx (1 hunks)
  • app/packages/spaces/src/components/AddPanelButton.tsx (2 hunks)
  • app/packages/spaces/src/components/StyledElements.tsx (1 hunks)
Additional context used
Path-based instructions (5)
app/packages/spaces/src/components/StyledElements.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/spaces/src/components/AddPanelButton.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/Modal.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/Actions/ActionsRow.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/Sidebar/Sidebar.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 not posted (9)
app/packages/spaces/src/components/StyledElements.tsx (1)

20-20: Approve the height adjustment with a suggestion for consistency check.

The change from "2em" to "32px" for modal instances of PanelTabs is approved as it ensures consistent sizing across different environments. However, it's important to ensure that this change aligns with the overall styling strategy of the project, especially regarding the use of absolute (px) versus relative (em) units.

Consider verifying the impact of this change on the overall layout, especially if other components use relative sizing. This can be done by visually inspecting the UI in different modal contexts or by setting up a review session with the design team.

app/packages/spaces/src/components/AddPanelButton.tsx (4)

5-6: Approved: Import statements and React hooks usage.

The import statements are appropriate and the use of React hooks (useState, useCallback, useMemo, useRef) aligns with React best practices.


15-15: Approved: Efficient use of Recoil state management.

Using useRecoilValue to access isModalActive directly is a streamlined and efficient approach for managing state in React components.


16-24: Approved: Refactoring of panelsPredicate function.

The use of useCallback with isModalActive as a dependency is a good practice for optimizing performance. The logic is clear and efficiently handles the modal state conditions.


15-15: Approved: Component logic and rendering.

The overall logic for handling the popout menu and filtering panels is well-implemented. The conditional rendering based on the open state and the availability of panels is efficiently handled.

Also applies to: 24-24

app/packages/core/src/components/Modal/Modal.tsx (1)

188-188: Approved: Dynamic modal height adjustment.

The change to dynamically adjust the modal height using calc(100% - 70px) enhances the flexibility of the modal's presentation across different devices. It's important to ensure that this change is tested across various screen sizes to maintain a consistent user experience.

Please verify the modal's appearance on different screen sizes to ensure consistent UX.

app/packages/core/src/components/Actions/ActionsRow.tsx (3)

Line range hint 1037-1045: Styles are appropriate for functionality.

The styles applied to DraggableHandleIconContainer are minimal and appropriate for its functionality as a draggable handle. The cursor behavior and alignment are well-defined.


Line range hint 1021-1035: Verify visual consistency and responsiveness.

The significant reduction in CSS styling rules within ModalActionsRowContainer could impact the visual presentation and layout. Please ensure that the component remains visually consistent and responsive across different devices and resolutions.


Line range hint 1047-1075: Approve implementation and suggest verification.

The ModalActionsRow component is well-implemented with its use of Draggable for x-axis movement, enhancing user interaction. However, ensure that all sub-components integrate seamlessly and function as expected within this draggable context.

@imanjra imanjra requested a review from a team September 5, 2024 16:54
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Commits

Files that changed from the base of the PR and between da37796 and 36df1cf.

Files selected for processing (6)
  • app/packages/core/src/components/Actions/ActionsRow.tsx (1 hunks)
  • app/packages/core/src/components/Modal/Modal.tsx (1 hunks)
  • app/packages/core/src/components/Sidebar/Sidebar.tsx (1 hunks)
  • app/packages/core/src/plugins/modal-sample.tsx (2 hunks)
  • app/packages/spaces/src/components/AddPanelButton.tsx (2 hunks)
  • app/packages/spaces/src/components/StyledElements.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (5)
  • app/packages/core/src/components/Actions/ActionsRow.tsx
  • app/packages/core/src/components/Modal/Modal.tsx
  • app/packages/core/src/components/Sidebar/Sidebar.tsx
  • app/packages/spaces/src/components/AddPanelButton.tsx
  • app/packages/spaces/src/components/StyledElements.tsx
Additional context used
Path-based instructions (1)
app/packages/core/src/plugins/modal-sample.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 not posted (2)
app/packages/core/src/plugins/modal-sample.tsx (2)

5-5: LGTM!

The import statement for the ViewInAr icon is correctly placed at the top of the file and follows the proper syntax.


17-17: LGTM!

The Icon property is correctly updated to use the imported ViewInAr icon. This change can improve the user experience by providing a specific visual representation for the modal sample plugin.

Copy link
Contributor

@sashankaryal sashankaryal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀

For subsequent PRs, could we also include more detailed descriptions of the fixes and enhancements?

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 36df1cf and 565d01e.

Files selected for processing (16)
  • app/packages/core/src/components/Actions/ActionsRow.tsx (2 hunks)
  • app/packages/core/src/components/Modal/Modal.tsx (5 hunks)
  • app/packages/core/src/components/Modal/ModalNavigation.tsx (1 hunks)
  • app/packages/core/src/components/Modal/ModalSamplePlugin.tsx (4 hunks)
  • app/packages/core/src/components/Sidebar/Sidebar.tsx (1 hunks)
  • app/packages/core/src/plugins/SchemaIO/components/DashboardView.tsx (3 hunks)
  • app/packages/core/src/plugins/modal-sample.tsx (2 hunks)
  • app/packages/operators/src/built-in-operators.ts (4 hunks)
  • app/packages/operators/src/useCustomPanelHooks.ts (3 hunks)
  • app/packages/spaces/src/components/AddPanelButton.tsx (2 hunks)
  • app/packages/spaces/src/components/Panel.tsx (2 hunks)
  • app/packages/spaces/src/components/StyledElements.tsx (1 hunks)
  • app/packages/spaces/src/contexts.ts (1 hunks)
  • app/packages/spaces/src/hooks.ts (7 hunks)
  • app/packages/spaces/src/state.ts (2 hunks)
  • app/packages/spaces/src/types.ts (1 hunks)
Files skipped from review due to trivial changes (3)
  • app/packages/core/src/components/Modal/ModalNavigation.tsx
  • app/packages/core/src/plugins/SchemaIO/components/DashboardView.tsx
  • app/packages/core/src/plugins/modal-sample.tsx
Files skipped from review as they are similar to previous changes (4)
  • app/packages/core/src/components/Actions/ActionsRow.tsx
  • app/packages/core/src/components/Modal/Modal.tsx
  • app/packages/core/src/components/Sidebar/Sidebar.tsx
  • app/packages/spaces/src/components/AddPanelButton.tsx
Additional context used
Path-based instructions (9)
app/packages/spaces/src/contexts.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/spaces/src/components/StyledElements.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/spaces/src/types.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/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.

app/packages/core/src/components/Modal/ModalSamplePlugin.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/spaces/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.

app/packages/operators/src/useCustomPanelHooks.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/spaces/src/hooks.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/operators/src/built-in-operators.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 (30)
app/packages/spaces/src/contexts.ts (2)

4-4: LGTM!

The code change is approved. The PanelContext now uses the updated PanelContextType type, which includes an additional optional property, scope, of type string. This change enhances the context's functionality by allowing it to carry more information.


6-6: LGTM!

The code change is approved. The new PanelContextType type definition includes an additional optional property, scope, of type string, alongside the existing node property of type SpaceNode. This change improves the data structure's capability, enabling more versatile usage of the context throughout the application.

app/packages/spaces/src/components/StyledElements.tsx (3)

15-19: LGTM!

The code change is approved. The removal of the conditional logic associated with the $isModal prop from the PanelTabs styled component streamlines the component by eliminating conditional styling, potentially leading to a more consistent layout across different usages. The change adheres to the best practices in React and styled-components.


21-21: LGTM!

The code change is approved. The removal of the conditional logic associated with the $isModalPanel prop from the StyledPanel styled component streamlines the component by eliminating conditional styling, potentially leading to a more consistent layout across different usages. The change adheres to the best practices in React and styled-components.


23-23: LGTM!

The code change is approved. Setting the height of the StyledPanel component to calc(100% - 28px) streamlines the component by eliminating conditional styling, potentially leading to a more consistent layout across different usages. The change adheres to the best practices in React and styled-components.

app/packages/spaces/src/types.ts (1)

68-68: LGTM!

The code change is approved. The addition of the optional scope property of type string to the PanelStateParameter type enhances its flexibility, allowing it to accommodate additional contextual information related to the panel's state. The change extends the functionality of the type while ensuring backward compatibility.

app/packages/spaces/src/components/Panel.tsx (4)

3-3: LGTM!

The code change is approved.


11-12: LGTM!

The code changes are approved.


20-25: LGTM!

The code changes are approved.


52-52: LGTM!

The code change is approved.

app/packages/core/src/components/Modal/ModalSamplePlugin.tsx (4)

7-7: LGTM!

The code change is approved.


31-33: LGTM!

The code changes are approved.


80-82: LGTM!

The code changes are approved.


92-100: LGTM!

The code changes are approved.

app/packages/spaces/src/state.ts (4)

61-62: LGTM!

The code changes are approved.


68-69: LGTM!

The code changes are approved.


128-131: LGTM!

The code changes are approved.


133-136: LGTM!

The code changes are approved.

app/packages/operators/src/useCustomPanelHooks.ts (3)

5-5: LGTM!

Repositioning the import statement is a minor change that improves code organization without affecting functionality.


11-11: LGTM!

Importing the useCurrentSample hook is a good change. It allows retrieving the current sample more directly, improving clarity and encapsulation by reducing the dependency on the execution context for sample retrieval.


77-77: LGTM!

Utilizing the currentSample variable derived from the new useCurrentSample hook, instead of accessing it through the execution context, is a good change. It improves clarity and encapsulation by reducing the dependency on the context object for sample retrieval. The change is consistently applied across both line 77 and 123.

Also applies to: 123-123

app/packages/spaces/src/hooks.ts (8)

26-26: LGTM!

Importing the panelIdToScopeAtom is a good addition. It suggests that the concept of scope is being incorporated into the panel state management, enabling more granular control over the panel state by associating a scope with each panel ID.


249-250: LGTM!

Adding the optional scope parameter to usePanelState and using it in the state selector is a good enhancement. It allows for more contextualized state management by incorporating the concept of scope. The useScope function centralizes the logic for determining the scope based on the provided argument or the current panel context, ensuring consistency. These changes enhance the flexibility and functionality of the panel state management system.

Also applies to: 252-252, 256-256


263-264: LGTM!

The updates to useSetPanelStateById are consistent with the changes made to usePanelState. The function now accepts an optional scope parameter and uses the useScope function to determine the appropriate scope. It also retrieves the scope associated with the panel ID using the panelIdToScope atom. The state selector panelStateSelector now passes the computed scope. These changes allow for setting the panel state based on the appropriate scope, enhancing the contextualized state management capabilities.

Also applies to: 268-269, 271-271, 274-277


305-306: LGTM!

The updates to usePanelStateCallback are consistent with the changes made to other functions. It now accepts an optional scope parameter and uses the useScope function to determine the appropriate scope. The state selector panelStateSelector passes the scope derived from useScope, allowing the callback to access the panel state based on the provided or determined scope. These changes enhance the contextualized state management capabilities.

Also applies to: 308-308, 315-315


325-326: LGTM!

The updates to usePanelStateByIdCallback are consistent with the changes made to other functions. It now accepts an optional scope parameter and uses the useScope function to determine the appropriate scope. The state selector panelStateSelector passes the scope derived from useScope, allowing the callback to access the panel state based on the provided or determined scope. These changes enhance the contextualized state management capabilities.

Also applies to: 328-328, 333-333


346-347: LGTM!

The updates to usePanelStateLazy are consistent with the changes made to other functions. It now accepts an optional scope parameter and uses the useScope function to determine the appropriate scope. The state selector panelStateSelector passes the scope derived from useScope, allowing lazy access to the panel state based on the provided or determined scope. These changes enhance the contextualized state management capabilities.

Also applies to: 354-356


371-372: LGTM!

The updates to usePanelStatePartial are consistent with the changes made to other functions. It now accepts an optional scope parameter and uses the useScope function to determine the appropriate scope. The state selector panelStatePartialSelector passes the scope derived from useScope, allowing access to a partial panel state based on the provided or determined scope. These changes enhance the contextualized state management capabilities.

Also applies to: 374-374, 378-378


457-462: LGTM!

The introduction of the useScope utility function is a good addition. It centralizes the logic for determining the scope by checking if the scope parameter is a string and returning it; otherwise, it retrieves the scope from the panel context. This function provides a consistent way to determine the appropriate scope based on the provided argument or the current panel context. It is used across multiple functions to ensure consistency in scope determination, enhancing the maintainability and readability of the code.

app/packages/operators/src/built-in-operators.ts (1)

14-14: Verify the usage of setPathUserUnchanged.

The new import statement for setPathUserUnchanged suggests a

});

function getStateAtom(local?: boolean, scope?: string) {
console.log(">>> scope: ", scope);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the console log statement.

The console log statement is likely used for debugging purposes and should be removed before merging the code.

Apply this diff to remove the console log statement:

-console.log(">>> scope: ", scope);
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
console.log(">>> scope: ", scope);

@sashankaryal sashankaryal changed the base branch from develop to feat/timeline September 13, 2024 19:22
@sashankaryal sashankaryal changed the base branch from feat/timeline to develop September 13, 2024 19:24
@imanjra
Copy link
Contributor Author

imanjra commented Sep 16, 2024

E2E failure is unrelated and will be addressed as follow-up. Merging.

@imanjra imanjra merged commit 71e926a into develop Sep 16, 2024
11 of 12 checks passed
@imanjra imanjra deleted the bugfix/modal-spaces branch September 16, 2024 17:39
@coderabbitai coderabbitai bot mentioned this pull request Oct 4, 2024
5 tasks
@coderabbitai coderabbitai bot mentioned this pull request Oct 18, 2024
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants