mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-15 09:46:19 +01:00
🐛 Fix moving between wrappers not working
This commit is contained in:
@@ -20,6 +20,8 @@ export const useConfigStore = create<UseConfigStoreType>((set, get) => ({
|
||||
const { configs } = get();
|
||||
const currentConfig = configs.find((x) => x.value.configProperties.name === name);
|
||||
if (!currentConfig) return;
|
||||
// copies the value of currentConfig and creates a non reference object named previousConfig
|
||||
const previousConfig: ConfigType = JSON.parse(JSON.stringify(currentConfig.value));
|
||||
|
||||
// TODO: update config on server
|
||||
const updatedConfig = updateCallback(currentConfig.value);
|
||||
@@ -31,7 +33,11 @@ export const useConfigStore = create<UseConfigStoreType>((set, get) => ({
|
||||
],
|
||||
}));
|
||||
|
||||
if (shouldRegenerateGridstack) {
|
||||
if (
|
||||
(typeof shouldRegenerateGridstack === 'boolean' && shouldRegenerateGridstack) ||
|
||||
(typeof shouldRegenerateGridstack === 'function' &&
|
||||
shouldRegenerateGridstack(previousConfig, updatedConfig))
|
||||
) {
|
||||
currentConfig.increaseVersion();
|
||||
}
|
||||
},
|
||||
@@ -43,6 +49,8 @@ interface UseConfigStoreType {
|
||||
updateConfig: (
|
||||
name: string,
|
||||
updateCallback: (previous: ConfigType) => ConfigType,
|
||||
shouldRegenerateGridstack?: boolean
|
||||
shouldRegenerateGridstace?:
|
||||
| boolean
|
||||
| ((previousConfig: ConfigType, currentConfig: ConfigType) => boolean)
|
||||
) => Promise<void>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user