mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-04-23 14:17:46 -04:00
Fix issues when saving the notification providers
This commit is contained in:
parent
30a17a0c67
commit
374e4bec87
2 changed files with 8 additions and 3 deletions
|
@ -123,6 +123,7 @@ export const NotificationView: FunctionComponent = () => {
|
|||
|
||||
const update = useUpdateArray<Settings.NotificationInfo>(
|
||||
notificationsKey,
|
||||
notifications ?? [],
|
||||
"name"
|
||||
);
|
||||
|
||||
|
|
|
@ -82,7 +82,11 @@ export function useSettingValue<T>(
|
|||
}
|
||||
}
|
||||
|
||||
export function useUpdateArray<T>(key: string, compare: keyof T) {
|
||||
export function useUpdateArray<T>(
|
||||
key: string,
|
||||
current: Readonly<T[]>,
|
||||
compare: keyof T
|
||||
) {
|
||||
const { setValue } = useFormActions();
|
||||
const stagedValue = useStagedValues();
|
||||
|
||||
|
@ -93,9 +97,9 @@ export function useUpdateArray<T>(key: string, compare: keyof T) {
|
|||
if (key in stagedValue) {
|
||||
return stagedValue[key];
|
||||
} else {
|
||||
return [];
|
||||
return current;
|
||||
}
|
||||
}, [key, stagedValue]);
|
||||
}, [key, stagedValue, current]);
|
||||
|
||||
return useCallback(
|
||||
(v: T, hook?: HookType) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue