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 unneeded changeView call being done on mount #565

Merged
merged 2 commits into from
Oct 30, 2023

Conversation

raplemie
Copy link
Contributor

@raplemie raplemie commented Oct 27, 2023

Changes

  • ViewportComponent: Remove the default evaluation of the viewState in the useState initialiser because it gets automatically reset to undefined afterwards, but was causing a creation of the viewport (fulfilling the viewportRef then reassigned the viewState value that had just been recalculated. Since we want to reset the view when a new viewState is provided, we can't remove the "set...(undefined)", so simply starting with undefined resolves this issue.

  • FloatingViewportContent: The changeView call is not necessary because a new viewstate cause the viewportControl to be rememoized, which handles the viewstate change itself. However having it was causing any changes to the viewport (for example in the ref call) to be ignored/reset.

Testing

Tested manually in many scenario, mainly using "Content Layout" and "Content popout" fronstages. All unit and visual tests passes.

Issue

fixes #371

@raplemie raplemie requested a review from a team as a code owner October 27, 2023 20:51
@raplemie raplemie enabled auto-merge (squash) October 27, 2023 20:51
@raplemie raplemie merged commit 65d9e3f into master Oct 30, 2023
17 checks passed
@raplemie raplemie deleted the raplemie/ViewportExcessiveChangeViews branch October 30, 2023 16:32
@raplemie raplemie added the patch Changes in this PR requires a patch release label Nov 17, 2023
@raplemie
Copy link
Contributor Author

@Mergifyio backport release/4.6.x

Copy link
Contributor

mergify bot commented Nov 17, 2023

backport release/4.6.x

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Nov 17, 2023
(cherry picked from commit 65d9e3f)

# Conflicts:
#	docs/changehistory/NextVersion.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Changes in this PR requires a patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changed models visibility gets overriden initialViewState on ViewportComponent mount
2 participants