Skip to content

fix: sidebar showing when page is hidden#39735

Merged
alex-golovanov merged 8 commits intoreleasefrom
fix/39580-insolent-side-navigation-bar
Mar 19, 2025
Merged

fix: sidebar showing when page is hidden#39735
alex-golovanov merged 8 commits intoreleasefrom
fix/39580-insolent-side-navigation-bar

Conversation

@alex-golovanov
Copy link
Contributor

@alex-golovanov alex-golovanov commented Mar 14, 2025

Description

Fixes an issue, when the "Show Page Navigation" option is disabled in the page settings, the sidebar should not appear when navigating to that page. However, even after turning off navigation, the sidebar is still visible.

Fixes #39580

Automation

/ok-to-test tags="@tag.IDE,@tag.Git"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13900210279
Commit: d1385f8
Cypress dashboard.
Tags: @tag.IDE,@tag.Git
Spec:


Mon, 17 Mar 2025 14:04:53 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced a custom hook for retrieving sidebar width, enhancing the management of sidebar dimensions.
    • Added new functions for managing IDE-related functionalities, including retrieving base URLs and editable tab permissions.
  • Refactor

    • Streamlined the navigation component's logic and improved the organization of import statements.
    • Removed deprecated methods and interfaces related to sidebar width management, simplifying the codebase.
    • Enhanced the organization of import statements across various components for better clarity.
    • Refactored the sidebar component to improve readability and maintainability while preserving functionality.
    • Updated the handling of property pane actions to improve type safety and clarity.

@alex-golovanov alex-golovanov requested review from a team as code owners March 14, 2025 14:44
@alex-golovanov alex-golovanov requested review from rahulbarwal and removed request for a team March 14, 2025 14:44
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 14, 2025

Walkthrough

This PR removes the getSidebarWidth function and its related constants from the selectors and transitions sidebar width retrieval to a new custom hook, useSidebarWidth. Alongside this, the Navigation component has been refactored by reorganizing imports, renaming query parameters, updating side-effect hooks for header height adjustments and analytics events, and simplifying conditional rendering. File import groupings have also been restructured for clarity.

Changes

File(s) Change Summary
app/client/.../selectors/applicationSelectors.tsx Removed the getSidebarWidth function and associated documentation/comments and imports.
app/client/.../WidgetsEditor/components/NavigationAdjustedPageViewer.tsx
app/client/.../hooks/useAppViewerSidebarProperties.ts
app/client/.../hooks/useSidebarWidth.ts
Updated import organization and replaced useSelector(getSidebarWidth) with the new custom hook useSidebarWidth, with the latter added to determine sidebar width based on app state.
app/client/.../AppViewer/Navigation/index.tsx Reorganized imports; renamed query parameter from showNavBar to forceShowNavBar; restructured useEffect hooks for header height and analytics tracking; and streamlined conditional rendering logic using useMemo.
app/client/.../actions/propertyPaneActions.ts Updated imports related to ShowPropertyPanePayload type and removed its interface definition from the file.
app/client/.../reducers/uiReducers/propertyPaneReducer.tsx
app/client/.../reducers/uiReducers/tableFilterPaneReducer.tsx
Introduced a new interface ShowPropertyPanePayload in the reducer and updated the import source in the table filter pane reducer.
app/client/.../ce/entities/IDE/utils.ts Deleted file containing utility functions and interfaces related to IDE functionality.
app/client/.../ce/entities/IDE/utils/getBaseUrlsForIDEType.ts
app/client/.../ce/entities/IDE/utils/getEditableTabPermissions.ts
app/client/.../ce/entities/IDE/utils/getIDETypeByUrl.ts
app/client/.../ce/entities/IDE/utils/saveEntityName.ts
app/client/.../ce/entities/IDE/utils/index.ts
Added new utility functions and interfaces related to IDE management.

Sequence Diagram(s)

sequenceDiagram
    participant C as Component (NavigationAdjustedPageViewer / useAppViewerSidebarProperties)
    participant H as useSidebarWidth Hook
    participant R as Redux Store
    C->>H: Call useSidebarWidth()
    H->>R: useSelector to fetch app state (details, sidebar pinning, page id)
    R-->>H: Return state data
    H->>H: Compute sidebar width based on conditions
    H-->>C: Return computed width
Loading
sequenceDiagram
    participant Nav as Navigation Component
    participant R as Redux Store
    participant M as useMemo Hook
    Nav->>Nav: Read `forceShowNavBar` from query params
    Nav->>Nav: useEffect: Adjust header height based on navigation style/orientation
    Nav->>R: Dispatch header height update
    Nav->>Nav: useEffect: Trigger analytics events if conditions match
    Nav->>M: Evaluate navigation layout (Sidebar/TopHeader)
    M-->>Nav: Return layout component
    Nav->>User: Render updated Navigation UI
Loading

Assessment against linked issues

Objective Addressed Explanation
Ensure sidebar does not appear when navigation is turned off for a page (#39580)
Refactor sidebar width management to improve clarity and maintainability

Possibly related PRs

  • chore: Update size of sidebar + remove using sheet #37638: The changes in the main PR, which involve the removal of the getSidebarWidth function and related constants, are directly related to the modifications in the retrieved PR, where the sidebar's width management has been updated to use a custom hook instead of the removed selector.
  • chore: Split library side pane for adding package control section #36926: The changes in the main PR, which involve the removal of the getSidebarWidth function, are related to the modifications in the retrieved PR that increase the width of the Libraries pane and introduce a new method for managing sidebar width, indicating a direct connection in how sidebar width is handled.
  • chore: Visual changes for core navigation elements on IDE #37880: The changes in the main PR, which involve the removal of the getSidebarWidth function, are related to the modifications in the retrieved PR, where the sidebar width retrieval method is updated to use a custom hook instead of the removed selector. Both PRs address sidebar width management, indicating a direct connection at the code level.

Suggested labels

Critical, Production

Suggested reviewers

  • ankitakinger
  • sagar-qa007

Poem

In code’s realm, the old gives way to new,
Sidebar logic refined with a custom view.
Imports aligned, and flows set in place,
Clear and concise, a cleaner interface.
Here’s to fresh hooks and paths made bright 🚀!
Cheers to progress in every byte!


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 1e8cddb and d1385f8.

📒 Files selected for processing (1)
  • app/client/src/utils/hooks/useSidebarWidth.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-prettier / prettier-check
  • GitHub Check: client-build / client-build
🔇 Additional comments (1)
app/client/src/utils/hooks/useSidebarWidth.ts (1)

1-31: Well-structured React hook with clear responsibility

The implementation of useSidebarWidth is clean and follows best practices for React hooks. The hook properly handles conditional logic to determine sidebar width based on multiple factors including navigation settings and pinned state.

Good organization with:

  • Grouped imports for better readability
  • Descriptive JSDoc comments
  • Clear conditional logic
  • Proper use of optional chaining for handling potentially undefined values

This hook effectively replaces the previous selector-based approach with a more composable pattern.


🪧 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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.

@github-actions github-actions bot added App Navigation Issues related to the topbar navigation and configuring it Bug Something isn't working Community Reported issues reported by community members High This issue blocks a user from building or impacts a lot of users IDE Pod Issues that new developers face while exploring the IDE IDE Product Issues related to the IDE Product Needs Triaging Needs attention from maintainers to triage UI Building Product Issues related to the UI Building experience Unplanned Work - IDE Unplanned work items of pod IDE labels Mar 14, 2025
@alex-golovanov
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

@alex-golovanov alex-golovanov added the ok-to-test Required label for CI label Mar 14, 2025
@github-actions
Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/13859102336.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 39735.
recreate: .

@github-actions
Copy link

🔴🔴🔴 Cyclic Dependency Check:

This PR has increased the number of cyclic dependencies by 1, when compared with the release branch.

Refer this document to identify the cyclic dependencies introduced by this PR.

You can view the dependency diff in the run log. Look for the check-cyclic-dependencies job in the run.

@github-actions
Copy link

Deploy-Preview-URL: https://ce-39735.dp.appsmith.com

@@ -1,23 +1,32 @@
import type { ReactNode } from "react";
// React and core libraries
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just curious why we need these comments? Over time, it all degrades as code editors automatically add imports.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are done by copilot. Do you think it's better to remove the comments and just leave blank lines?

KelvinOm
KelvinOm previously approved these changes Mar 14, 2025
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

🧹 Nitpick comments (2)
app/client/src/ce/entities/IDE/utils/saveEntityName.ts (1)

15-23: Consider a more declarative approach

The current implementation uses a mutable variable that gets conditionally reassigned. Consider a more declarative approach:

- export const saveEntityName = ({ params, segment }: SaveEntityName) => {
-   let saveNameAction = saveActionName(params);
- 
-   if (EditorEntityTab.JS === segment) {
-     saveNameAction = saveJSObjectName(params);
-   }
- 
-   return saveNameAction;
- };
+ export const saveEntityName = ({ params, segment }: SaveEntityName) => {
+   return EditorEntityTab.JS === segment
+     ? saveJSObjectName(params)
+     : saveActionName(params);
+ };

Also note that the entity parameter is defined in the interface but not used in the function.

app/client/src/ce/entities/IDE/utils/getEditableTabPermissions.ts (1)

21-29: Function is a thin wrapper around getHasManageActionPermission

This function provides a clean interface for checking permissions with proper default handling for the entity's userPermissions. Consider adding a comment explaining why this wrapper exists instead of directly using getHasManageActionPermission.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between c5ffc0a and 00a3606.

📒 Files selected for processing (9)
  • app/client/src/actions/propertyPaneActions.ts (1 hunks)
  • app/client/src/ce/entities/IDE/utils.ts (0 hunks)
  • app/client/src/ce/entities/IDE/utils/getBaseUrlsForIDEType.ts (1 hunks)
  • app/client/src/ce/entities/IDE/utils/getEditableTabPermissions.ts (1 hunks)
  • app/client/src/ce/entities/IDE/utils/getIDETypeByUrl.ts (1 hunks)
  • app/client/src/ce/entities/IDE/utils/index.ts (1 hunks)
  • app/client/src/ce/entities/IDE/utils/saveEntityName.ts (1 hunks)
  • app/client/src/reducers/uiReducers/propertyPaneReducer.tsx (1 hunks)
  • app/client/src/reducers/uiReducers/tableFilterPaneReducer.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • app/client/src/ce/entities/IDE/utils.ts
✅ Files skipped from review due to trivial changes (2)
  • app/client/src/reducers/uiReducers/tableFilterPaneReducer.tsx
  • app/client/src/ce/entities/IDE/utils/index.ts
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-build / client-build
  • GitHub Check: client-prettier / prettier-check
🔇 Additional comments (5)
app/client/src/reducers/uiReducers/propertyPaneReducer.tsx (1)

10-14: Good code organization - moving the interface to its logical location.

The ShowPropertyPanePayload interface has been moved from the actions file to the reducer where it's being used, which follows good code organization principles. This improves maintainability by keeping type definitions close to their primary usage.

app/client/src/actions/propertyPaneActions.ts (1)

2-5: Import updated to match relocated interface.

This import statement has been correctly updated to reflect the relocation of the ShowPropertyPanePayload interface to the reducer file. This maintains the functionality while improving code organization.

app/client/src/ce/entities/IDE/utils/getBaseUrlsForIDEType.ts (1)

4-6: Simple and effective implementation

The function cleanly retrieves base URLs for a specified IDE type.

app/client/src/ce/entities/IDE/utils/getIDETypeByUrl.ts (1)

6-14: Implementation looks correct, but type assertion should be reviewed

The function effectively maps URLs to IDE types by iterating through IDEBasePaths. However, note the type assertion on line 7 (type as IDEType). Since this comes from iterating through object keys, it should be safe, but worth verifying that all keys in IDEBasePaths conform to IDEType.

app/client/src/ce/entities/IDE/utils/getEditableTabPermissions.ts (1)

10-14: Clear constant definition

The EDITOR_PATHS array effectively consolidates the builder paths in one accessible location.

@alex-golovanov alex-golovanov removed the ok-to-test Required label for CI label Mar 17, 2025
@alex-golovanov alex-golovanov added the ok-to-test Required label for CI label Mar 17, 2025
@alex-golovanov
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

@github-actions
Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/13900416740.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 39735.
recreate: .

@github-actions
Copy link

Deploy-Preview-URL: https://ce-39735.dp.appsmith.com

@alex-golovanov alex-golovanov merged commit 67ba606 into release Mar 19, 2025
45 checks passed
@alex-golovanov alex-golovanov deleted the fix/39580-insolent-side-navigation-bar branch March 19, 2025 10:45
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Apr 12, 2025
## Description
Fixes an issue, when the "Show Page Navigation" option is disabled in
the page settings, the sidebar should not appear when navigating to that
page. However, even after turning off navigation, the sidebar is still
visible.

Fixes appsmithorg#39580

## Automation

/ok-to-test tags="@tag.IDE,@tag.Git"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/13900210279>
> Commit: d1385f8
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13900210279&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.IDE,@tag.Git`
> Spec:
> <hr>Mon, 17 Mar 2025 14:04:53 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Summary by CodeRabbit

- **New Features**
- Introduced a custom hook for retrieving sidebar width, enhancing the
management of sidebar dimensions.
- Added new functions for managing IDE-related functionalities,
including retrieving base URLs and editable tab permissions.

- **Refactor**
- Streamlined the navigation component's logic and improved the
organization of import statements.
- Removed deprecated methods and interfaces related to sidebar width
management, simplifying the codebase.
- Enhanced the organization of import statements across various
components for better clarity.
- Refactored the sidebar component to improve readability and
maintainability while preserving functionality.
- Updated the handling of property pane actions to improve type safety
and clarity.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

App Navigation Issues related to the topbar navigation and configuring it Bug Something isn't working Community Reported issues reported by community members High This issue blocks a user from building or impacts a lot of users IDE Pod Issues that new developers face while exploring the IDE IDE Product Issues related to the IDE Product Needs Triaging Needs attention from maintainers to triage ok-to-test Required label for CI UI Building Product Issues related to the UI Building experience Unplanned Work - IDE Unplanned work items of pod IDE

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Side Navigation bar shows up for a Page even after navigation is turned off for it

3 participants