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: revert "fix: canvas resizing issues" #35129

Merged
merged 1 commit into from
Jul 24, 2024

Conversation

alex-golovanov
Copy link
Contributor

@alex-golovanov alex-golovanov commented Jul 24, 2024

Description

This reverts commit cbe1f58.

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/10072532868
Commit: 9ab856d
Cypress dashboard.
Tags: @tag.All
Spec:


Wed, 24 Jul 2024 09:06:01 UTC

Communication

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

  • Yes
  • No

@alex-golovanov alex-golovanov requested review from a team and riodeuno and removed request for a team July 24, 2024 07:36
Copy link
Contributor

coderabbitai bot commented Jul 24, 2024

Walkthrough

The recent changes across multiple components focus on enhancing modularity and simplifying the logic of the application. A new custom hook, useDynamicAppLayout, has been introduced to manage dynamic layout functionalities, replacing several older implementations. This shift not only improves code clarity but also integrates Redux for better state management and responsiveness. Overall, these updates aim to streamline the application while maintaining its core functionality.

Changes

Files Change Summary
.../MainContainerResizer.tsx Changed the import of AUTOLAYOUT_RESIZER_WIDTH_BUFFER from a local constants file to a utility hook, enhancing modularity.
.../AppViewer/AppPage.tsx Removed useDispatch, updated layout logic to reference props.canvasWidth, and streamlined event logging by utilizing props directly.
.../Editor/IDE/AppsmithIDE.test.tsx Updated import from useCanvasWidthAutoResize to useDynamicAppLayout, reflecting a shift in testing focus.
.../WidgetsEditor/components/MainContainerWrapper.tsx Changed export to default for MainContainerWrapper, replaced useCanvasWidthAutoResize with useDynamicAppLayout, and simplified effect cleanup logic.
.../WidgetsEditor/components/NavigationAdjustedPageViewer.tsx Changed the import source of PageViewWrapper from AppPage to AppPage.styled, indicating a shift in styling approach.
.../utils/hooks/useDynamicAppLayout.tsx Introduced a new custom hook that dynamically manages application layout using Redux, enhancing responsiveness and lifecycle management.
.../ContainerWidget/widget/index.test.tsx Updated import from useCanvasWidthAutoResize to useDynamicAppLayoutHook, shifting the focus of the test suite toward the new dynamic layout implementation.

Sequence Diagram(s)

sequenceDiagram
    participant C as Component
    participant H as useDynamicAppLayout
    participant R as Redux Store

    C->>H: Request layout info
    H->>R: Retrieve layout state
    R-->>H: Return layout state
    H-->>C: Provide updated layout info
    C->>C: Render updated layout
Loading

Poem

In the code where widgets play,
A new hook brightens the day!
Layouts dance, old paths unwind,
In every line, new joys we find.
Clean and clear, the logic sings,
Embracing change, oh, what it brings! 🎉


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>.
    • 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 show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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 the Bug Something isn't working label Jul 24, 2024
@alex-golovanov alex-golovanov added the ok-to-test Required label for CI label Jul 24, 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: 1

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b1ff50b and 9ab856d.

Files selected for processing (7)
  • app/client/src/layoutSystems/common/mainContainerResizer/MainContainerResizer.tsx (1 hunks)
  • app/client/src/pages/AppViewer/AppPage.tsx (2 hunks)
  • app/client/src/pages/Editor/IDE/AppsmithIDE.test.tsx (2 hunks)
  • app/client/src/pages/Editor/WidgetsEditor/components/MainContainerWrapper.tsx (7 hunks)
  • app/client/src/pages/Editor/WidgetsEditor/components/NavigationAdjustedPageViewer.tsx (1 hunks)
  • app/client/src/utils/hooks/useDynamicAppLayout.tsx (1 hunks)
  • app/client/src/widgets/ContainerWidget/widget/index.test.tsx (2 hunks)
Files skipped from review due to trivial changes (1)
  • app/client/src/pages/Editor/WidgetsEditor/components/NavigationAdjustedPageViewer.tsx
Additional context used
Biome
app/client/src/utils/hooks/useDynamicAppLayout.tsx

[error] 169-169: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.

The declaration is defined in this switch clause:

Unsafe fix: Wrap the declaration in a block.

(lint/correctness/noSwitchDeclarations)

Additional comments not posted (19)
app/client/src/pages/AppViewer/AppPage.tsx (3)

1-5: Good job on updating the imports!

The inclusion of useDynamicAppLayout and removal of useDispatch indicates a move towards a more modular and streamlined approach to managing layout dynamics.


29-30: Great use of useMemo for width calculation!

Referencing props.canvasWidth directly improves clarity and ensures consistent width calculation.


32-32: Excellent use of useDynamicAppLayout!

Introducing the useDynamicAppLayout hook simplifies the layout management logic and reduces dependencies on Redux.

app/client/src/widgets/ContainerWidget/widget/index.test.tsx (2)

5-5: Nice update on the import statement!

Replacing useCanvasWidthAutoResize with useDynamicAppLayoutHook reflects the updated functionality being tested.


23-23: Good job updating the spy!

Updating the spy to useDynamicAppLayout ensures that the tests are validating the new dynamic layout behavior.

app/client/src/layoutSystems/common/mainContainerResizer/MainContainerResizer.tsx (1)

7-7: Great refactor on the import statement!

Importing AUTOLAYOUT_RESIZER_WIDTH_BUFFER from utils/hooks/useDynamicAppLayout consolidates the source of constants and improves modularity.

app/client/src/pages/Editor/WidgetsEditor/components/MainContainerWrapper.tsx (4)

25-25: Good job adding the new import!

The useDynamicAppLayout hook is correctly imported and will be used in the component.


110-110: Nice change to default export!

Changing MainContainerWrapper to a default export can simplify imports in other parts of the application.


131-132: Good implementation of the new hook!

Replacing useCanvasWidthAutoResize with useDynamicAppLayout seems to streamline the layout management logic.


141-141: Ensure the useEffect dependency array change is intentional.

Changing the dependency array to an empty array means the effect will only run once on mount. Ensure that this change does not affect any necessary updates tied to the dispatch function.

app/client/src/utils/hooks/useDynamicAppLayout.tsx (7)

1-39: Good job on the comprehensive imports!

All necessary utilities and hooks are imported, ensuring the hook can function correctly.


40-291: Excellent implementation of the custom hook!

The useDynamicAppLayout hook is well-structured and covers various layout scenarios. The use of memoization and debouncing is a great touch for performance optimization.

Tools
Biome

[error] 169-169: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.

The declaration is defined in this switch clause:

Unsafe fix: Wrap the declaration in a block.

(lint/correctness/noSwitchDeclarations)


203-218: Good use of ResizeObserver!

The implementation of ResizeObserver within the useEffect hook is well done, ensuring the canvas resizes dynamically.


220-222: Nice implementation of debounced resizing!

The use of debounced resizing ensures that the layout updates are optimized and do not cause unnecessary re-renders.


240-257: Thorough layout resize effect!

The useEffect hook covers various conditions for resizing the layout, ensuring that the canvas adjusts correctly based on the application state.


259-269: Good handling of mobile breakpoints!

The useEffect hook ensures that the layout updates correctly for mobile breakpoints.


271-289: Effective canvas resizing logic!

The useEffect hook handles canvas resizing effectively, ensuring that the layout updates correctly when the canvas is resized.

app/client/src/pages/Editor/IDE/AppsmithIDE.test.tsx (2)

25-25: Good job updating the import!

The import statement for useDynamicAppLayout correctly reflects the changes in the application logic.


109-109: Nice update to the hook mocking!

The spy on useDynamicAppLayout ensures that the test correctly mocks the new hook's implementation.

@alex-golovanov alex-golovanov merged commit ddc2304 into release Jul 24, 2024
88 checks passed
@alex-golovanov alex-golovanov deleted the revert-35004-fix/34741-canvas-resizing branch July 24, 2024 09:10
@shadabbuchh
Copy link

This PR fixes #35126 .
Verified on release that the above issue is resolved.
https://jam.dev/c/72f3d902-e865-409a-a2f6-80ac38d4866a

rishabhrathod01 added a commit that referenced this pull request Jul 26, 2024
## Description
This reverts commit cbe1f58.

## 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/10072532868>
> Commit: 9ab856d
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10072532868&attempt=2"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.All`
> Spec:
> <hr>Wed, 24 Jul 2024 09:06:01 UTC
<!-- end of auto-generated comment: Cypress test results  -->

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

## Description
> [!TIP]
> _Add a TL;DR when the description is longer than 500 words or extremely technical (helps the content, marketing, and DevRel team)._
>
> _Please also include relevant motivation and context. List any dependencies that are required for this change. Add links to Notion, Figma or any other documents that might be relevant to the PR._

Fixes #`Issue Number`
_or_
Fixes `Issue URL`
> [!WARNING]
> _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._

## Automation

/ok-to-test tags=""

### :mag: Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!CAUTION]
> If you modify the content in this section, you are likely to disrupt the CI result for your PR.

<!-- end of auto-generated comment: Cypress test results  -->

## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No
MajaharZemoso pushed a commit to MajaharZemoso/appsmith that referenced this pull request Jul 28, 2024
## Description
This reverts commit cbe1f58.

## 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/10072532868>
> Commit: 9ab856d
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10072532868&attempt=2"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.All`
> Spec:
> <hr>Wed, 24 Jul 2024 09:06:01 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [x] No
@coderabbitai coderabbitai bot mentioned this pull request Oct 29, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working ok-to-test Required label for CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants