Skip to content
Merged
Changes from 3 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
22 changes: 12 additions & 10 deletions packages/redux/src/selectors.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { UndoPartial } from '@deephaven/utils';
import { memoize } from 'proxy-memoize';
import type { RootState, WorkspaceSettings } from './store';
import type { RootState } from './store';
import _ from 'lodash';

Check failure on line 4 in packages/redux/src/selectors.ts

View workflow job for this annotation

GitHub Actions / unit

`lodash` import should occur before type import of `./store`

Check failure on line 4 in packages/redux/src/selectors.ts

View workflow job for this annotation

GitHub Actions / unit

'@types/lodash' should be listed in the project's dependencies. Run 'npm i -S @types/lodash' to add it

const EMPTY_OBJECT = Object.freeze({});

Expand Down Expand Up @@ -62,16 +63,17 @@
): UndoPartial<State['workspace']['data']['settings']> => {
const customizedSettings = getWorkspace(store)?.data.settings ?? {};

const settings = { ...getDefaultWorkspaceSettings(store) };
const keys = Object.keys(customizedSettings) as (keyof WorkspaceSettings)[];
for (let i = 0; i < keys.length; i += 1) {
const key = keys[i];
if (customizedSettings[key] !== undefined) {
// @ts-expect-error assign non-undefined customized settings to settings
settings[key] = customizedSettings[key];
return _.mergeWith(
{},
getDefaultWorkspaceSettings(store),
customizedSettings,
(objValue, srcValue) => {
if (Array.isArray(objValue) && Array.isArray(srcValue)) {
return srcValue;
}
return undefined;
}
}
return settings as UndoPartial<State['workspace']['data']['settings']>;
) as UndoPartial<State['workspace']['data']['settings']>;
}
);

Expand Down
Loading