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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@itwin/appui-react",
"comment": "Remove unneeded `changeView` call on `FloatingViewportComponent`",
"type": "none"
}
],
"packageName": "@itwin/appui-react"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@itwin/imodel-components-react",
"comment": "Remove additional `changeView` call on `ViewportComponent` mount.",
"type": "none"
}
],
"packageName": "@itwin/imodel-components-react"
}
13 changes: 11 additions & 2 deletions docs/changehistory/NextVersion.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ Table of contents:
- [Additions](#additions)
- [Changes](#changes)
- [Fixes](#fixes)
- [@itwin/components-react](#itwincomponents-react)
- [@itwin/imodel-components-react](#itwinimodel-components-react)
- [Fixes](#fixes-1)
- [@itwin/core-react](#itwincore-react)
- [@itwin/components-react](#itwincomponents-react)
- [Fixes](#fixes-2)
- [@itwin/core-react](#itwincore-react)
- [Fixes](#fixes-3)

## @itwin/appui-react

Expand Down Expand Up @@ -67,6 +69,13 @@ Table of contents:
- Unmount `ChildWindowManager` whenever child window is closed.
- Whenever widget is popped out and `window.open` fails, widget no longer disappears.
- Fix error when `HTMLElement` used in `NotifyMessageDetails` messages.
- Remove unneeded `changeView` call in `FloatingViewportComponent`.

## @itwin/imodel-components-react

### Fixes

- Remove unneeded `changeView` call when mounting `ViewportComponent`.

## @itwin/components-react

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,8 @@ export function useFloatingViewport(args: FloatingViewportContentProps) {
if (null === contentControl.current.reactNode) {
contentControl.current.reactNode = viewportControl;
}
void contentControl.current.viewport.changeView(viewState);
}
}, [viewState, viewport, viewportControl]);
}, [viewport, viewportControl]);

React.useEffect(() => {
const onViewClose = (vp: ScreenViewport) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,14 +294,7 @@ export function ViewportComponent(props: ViewportProps) {

const [initialViewState, setInitialViewState] = React.useState<
ViewState | undefined
>(() => {
if (viewState) {
if (typeof viewState === "function") return viewState().clone();
else return viewState.clone();
}
return undefined;
});

>(undefined);
React.useEffect(() => {
setInitialViewState(undefined);
}, [viewDefinitionId, viewState]);
Expand Down