Skip to content

Commit

Permalink
fix: LayerManagerComponentWrapper not updating when items in `Layer…
Browse files Browse the repository at this point in the history
…Manager` are changing (#829)
  • Loading branch information
rubenthoms authored Dec 18, 2024
1 parent bd137c6 commit ee059ee
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions frontend/src/modules/2DViewer/registerModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@ ModuleRegistry.registerModule<Interfaces>({
ModuleDataTagId.GRID3D,
ModuleDataTagId.POLYGONS,
],
onInstanceUnload: (instanceId) => {
window.localStorage.removeItem(`${instanceId}-settings`);
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import { MenuButton } from "@lib/components/MenuButton";
import { MenuHeading } from "@lib/components/MenuHeading";
import { MenuItem } from "@lib/components/MenuItem";
import { LayersActionGroup } from "@modules/2DViewer/layers/LayersActions";
import { GroupDelegate } from "@modules/2DViewer/layers/delegates/GroupDelegate";
import { GroupDelegate, GroupDelegateTopic } from "@modules/2DViewer/layers/delegates/GroupDelegate";
import { usePublishSubscribeTopicValue } from "@modules/2DViewer/layers/delegates/PublishSubscribeDelegate";
import { ColorScale } from "@modules/2DViewer/layers/framework/ColorScale/ColorScale";
import { DeltaSurface } from "@modules/2DViewer/layers/framework/DeltaSurface/DeltaSurface";
import { LayerManager } from "@modules/2DViewer/layers/framework/LayerManager/LayerManager";
Expand Down Expand Up @@ -53,10 +54,10 @@ export type LayerManagerComponentWrapperProps = {

export function LayerManagerComponentWrapper(props: LayerManagerComponentWrapperProps): React.ReactNode {
const colorSet = props.workbenchSettings.useColorSet();

const [preferredViewLayout, setPreferredViewLayout] = useAtom(preferredViewLayoutAtom);

const groupDelegate = props.layerManager.getGroupDelegate();
usePublishSubscribeTopicValue(groupDelegate, GroupDelegateTopic.CHILDREN);

function handleLayerAction(identifier: string, groupDelegate: GroupDelegate) {
const numSharedSettings = groupDelegate.findChildren((item) => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/modules/2DViewer/settings/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useAtom, useAtomValue, useSetAtom } from "jotai";

import { layerManagerAtom, preferredViewLayoutAtom, userSelectedFieldIdentifierAtom } from "./atoms/baseAtoms";
import { selectedFieldIdentifierAtom } from "./atoms/derivedAtoms";
import { LayerManagerComponentWrapper } from "./components/layerManagerComponent";
import { LayerManagerComponentWrapper } from "./components/layerManagerComponentWrapper";

import { GroupDelegateTopic } from "../layers/delegates/GroupDelegate";
import { LayerManager, LayerManagerTopic } from "../layers/framework/LayerManager/LayerManager";
Expand Down

0 comments on commit ee059ee

Please sign in to comment.