Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 12 additions & 0 deletions packages/base/src/panelview/leftpanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ export const LeftPanel: React.FC<ILeftPanelProps> = (
);

React.useEffect(() => {
const syncFromSettingsRegistry = async () => {
const registry = await props.model.getSettings();
const composite = registry?.composite;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need a little help understanding this pattern of merging composite with the previous value of settings. From the docs, composite is "The composite of user settings and extension defaults.", which I read to mean the current actual settings. Is that right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you are correct. composite represents the effective settings after merging defaults, system, and user overrides, so it is the current source of truth from the settings registry.
Sure we can omit the merging of previous value into the composite.

Copy link
Member

@mfisher87 mfisher87 Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've read some of the other code where we access settings (tools.ts) and I'm confused about why it's done the way it's done. Perhaps we could write some docs on this (different PR).

if (composite) {
setSettings(prev => ({
...prev,
...composite,
}));
}
};
const onSettingsChanged = () => {
setSettings({ ...props.model.jgisSettings });
};
Expand All @@ -52,6 +62,8 @@ export const LeftPanel: React.FC<ILeftPanelProps> = (
setLayerTree(props.model.getLayerTree() || []);
};

Promise.resolve().then(syncFromSettingsRegistry);

props.model.settingsChanged.connect(onSettingsChanged);
props.model.sharedOptionsChanged.connect(onOptionsChanged);
props.model.sharedModel.layersChanged.connect(updateLayerTree);
Expand Down
12 changes: 12 additions & 0 deletions packages/base/src/panelview/rightpanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ export const RightPanel: React.FC<IRightPanelProps> = props => {
});

React.useEffect(() => {
const syncFromSettingsRegistry = async () => {
const register = await props.model.getSettings();
const composite = register?.composite;
if (composite) {
setSettings(prev => ({
...prev,
...composite,
}));
}
};
const onSettingsChanged = () => {
setSettings({ ...props.model.jgisSettings });
};
Expand All @@ -81,6 +91,8 @@ export const RightPanel: React.FC<IRightPanelProps> = props => {
}
};

Promise.resolve().then(syncFromSettingsRegistry);

props.model.settingsChanged.connect(onSettingsChanged);
props.model.sharedOptionsChanged.connect(onOptionsChanged);
props.model.clientStateChanged.connect(onAwerenessChanged);
Expand Down
Loading