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

fix: property pane in preview mode #38274

Merged
merged 3 commits into from
Dec 20, 2024

Conversation

alex-golovanov
Copy link
Contributor

@alex-golovanov alex-golovanov commented Dec 20, 2024

Description

Fixes an issue where property pane appeared in preview mode under certain conditions.

Fixes #37278

Automation

/ok-to-test tags="@tag.All"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12428449390
Commit: b61d77a
Cypress dashboard.
Tags: @tag.All
Spec:


Fri, 20 Dec 2024 10:28:59 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Introduced a new StaticLayout component for improved layout management.
  • Bug Fixes

    • Enhanced readability and consistency in defining column widths for various editor states.
  • Chores

    • Updated imports and exports to replace the deprecated UnanimatedLayout with StaticLayout.

Copy link
Contributor

coderabbitai bot commented Dec 20, 2024

Walkthrough

The pull request focuses on refactoring the layout components in the Appsmith IDE, specifically replacing UnanimatedLayout with a new StaticLayout component. The changes involve modifying how layout templates are generated, updating imports, and adjusting the rendering logic in the IDE component. The modifications aim to improve the layout management and potentially address issues with component visibility in different application states.

Changes

File Change Summary
app/client/src/pages/Editor/IDE/Layout/StaticLayout.tsx Replaced UnanimatedLayout with memoized StaticLayout component using useSelector and useGridLayoutTemplate hooks
app/client/src/pages/Editor/IDE/Layout/hooks/useGridLayoutTemplate.ts Updated column width definitions using template literals instead of type assertions
app/client/src/pages/Editor/IDE/Layout/index.ts Removed UnanimatedLayout export, added StaticLayout export
app/client/src/pages/Editor/IDE/index.tsx Updated layout import from UnanimatedLayout to StaticLayout

Assessment against linked issues

Objective Addressed Explanation
Property pane visibility in preview mode [#37278]

Possibly related PRs

Suggested labels

Bug, UI Improvement, ok-to-test, IDE Product, Task, Needs Triaging

Suggested reviewers

  • AmanAgarwal041
  • albinAppsmith
  • sagar-qa007

Poem

In the realm of code, where layouts dance and sway,
Static meets dynamic, finding a brand new way
Pixels align, components take their place
A refactored layout with algorithmic grace
Appsmith's IDE, now sleeker than before! 🖥️✨

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


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 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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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 Bug Something isn't working 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 Preview mode Issues related to app previews Production labels Dec 20, 2024
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 (1)
app/client/src/pages/Editor/IDE/Layout/hooks/useGridLayoutTemplate.ts (1)

58-58: Extract magic numbers into named constants

The calculation uses hardcoded values (300, 50) which should be named constants for better maintainability.

+ const EXPLORER_WIDTH = 300;
+ const PADDING_ADJUSTMENT = 50;  // Document the purpose of this adjustment
- `${windowWidth - 300 - 50}px`,
+ `${windowWidth - EXPLORER_WIDTH - PADDING_ADJUSTMENT}px`,
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d1cff32 and b61d77a.

📒 Files selected for processing (4)
  • app/client/src/pages/Editor/IDE/Layout/StaticLayout.tsx (2 hunks)
  • app/client/src/pages/Editor/IDE/Layout/hooks/useGridLayoutTemplate.ts (2 hunks)
  • app/client/src/pages/Editor/IDE/Layout/index.ts (1 hunks)
  • app/client/src/pages/Editor/IDE/index.tsx (2 hunks)
🔇 Additional comments (8)
app/client/src/pages/Editor/IDE/Layout/index.ts (1)

Line range hint 1-3: LGTM: Clean export changes

The export changes correctly reflect the component replacement from UnanimatedLayout to StaticLayout.

app/client/src/pages/Editor/IDE/Layout/StaticLayout.tsx (2)

Line range hint 28-64: LGTM: Well-structured layout implementation

The StaticLayout component is well-implemented with:

  • Proper memoization
  • Clean grid template management
  • Conditional rendering for protected mode and sidebar

25-25: Verify overflow behavior fix

The addition of overflow: auto appears to be the key fix for the property pane preview mode issue. Please verify this resolves the original issue #37278 completely.

app/client/src/pages/Editor/IDE/index.tsx (1)

3-3: LGTM: Clean component replacement

The StaticLayout integration is clean and preserves the existing feature flag behavior.

Also applies to: 25-25

app/client/src/pages/Editor/IDE/Layout/hooks/useGridLayoutTemplate.ts (4)

53-53: LGTM! Consistent preview mode handling

The preview/protected mode column calculations are consistent across all states, correctly utilizing the full window width.

Also applies to: 66-66, 79-79


70-71: LGTM! Good use of constants

The settings pane width calculations properly utilize defined constants, making the code maintainable.


84-84: LGTM! Consistent with settings pattern

The libraries pane width calculation follows the same pattern as settings, maintaining consistency.


117-119: Verify the purpose of +1px adjustment

The PropertyPane width calculation includes a +1px adjustment which seems like a workaround. Could you clarify if this is addressing a specific layout issue?

✅ Verification successful

Let me search for more context about the layout calculations and PropertyPane width adjustments.


Let me search for any related layout issues or discussions in the codebase.


Let me search for any related grid layout or border adjustments in the codebase.


Let me try one final search to understand the grid layout calculations.


The +1px adjustment is necessary for grid layout precision

The +1px adjustment in both the editor pane width and PropertyPane width calculations is intentional. It ensures proper grid layout alignment when the UI segment is active, preventing any sub-pixel rendering issues or gaps between the panes in the grid layout template.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for related layout adjustments or known issues
rg -A 3 "PropertyPaneWidth.*\+" app/client/src/

Length of output: 584


Script:

#!/bin/bash
# Search for PropertyPane related layout calculations and constants
rg -B 2 -A 2 "PropertyPaneWidth" app/client/src/

# Search for any grid layout related comments or documentation
rg -B 2 -A 2 "grid.*layout|layout.*grid" app/client/src/ --type ts

Length of output: 12769


Script:

#!/bin/bash
# Search for any comments or discussions about layout issues or pixel adjustments
rg -B 2 -A 2 "layout.*issue|pixel.*adjust|border.*width" app/client/src/

# Look for constants related to layout widths
ast-grep --pattern 'const $_: number = $_'

Length of output: 65896


Script:

#!/bin/bash
# Search for grid layout related code and border adjustments
ast-grep --pattern 'const $_: string[] = [$$$]' app/client/src/pages/Editor/IDE/Layout/hooks/useGridLayoutTemplate.ts

# Look for any comments or documentation about grid layout or borders
rg -B 2 -A 2 "grid.*template|border.*adjust" app/client/src/pages/Editor/IDE/Layout/

Length of output: 206


Script:

#!/bin/bash
# Get the full content of the grid layout template file to understand the calculations
cat app/client/src/pages/Editor/IDE/Layout/hooks/useGridLayoutTemplate.ts

# Search for any related grid layout constants
rg -B 2 -A 2 "APP_SIDEBAR_WIDTH|PropertyPaneWidth" app/client/src/constants/

Length of output: 4935

@alex-golovanov
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

Copy link

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

@alex-golovanov alex-golovanov added the ok-to-test Required label for CI label Dec 20, 2024
Copy link

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

@alex-golovanov alex-golovanov merged commit 3c872eb into release Dec 20, 2024
86 checks passed
@alex-golovanov alex-golovanov deleted the fix/37278-property-pane-in-preview branch December 20, 2024 11:57
NandanAnantharamu pushed a commit that referenced this pull request Dec 27, 2024
## Description
Fixes an issue where property pane appeared in preview mode under
certain conditions.

Fixes [#37278](#37278)

## Automation

/ok-to-test tags="@tag.All"

### 🔍 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/12428449390>
> Commit: b61d77a
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12428449390&attempt=2"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.All`
> Spec:
> <hr>Fri, 20 Dec 2024 10:28:59 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

- **New Features**
- Introduced a new `StaticLayout` component for improved layout
management.
  
- **Bug Fixes**
- Enhanced readability and consistency in defining column widths for
various editor states.

- **Chores**
- Updated imports and exports to replace the deprecated
`UnanimatedLayout` with `StaticLayout`.

<!-- 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
Bug Something isn't working 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 Preview mode Issues related to app previews Production
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Property pane visible in preview mode
2 participants