Skip to content

Commit 25efcd0

Browse files
fix: QA issues
1 parent d37e150 commit 25efcd0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/blocks/helpers/use-settings.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { useState } from '@wordpress/element';
2929
* @returns {[(optionName: string) => any, (option: string, value: any, success?: string, noticeId?: string, onSuccess: Function) => void, 'loading' | 'loaded' | 'error' | 'saving']} [ getOption, updateOption, status ]
3030
*
3131
*/
32+
let updatedSettings = {};
3233
const useSettings = () => {
3334
const { createNotice } = dispatch( 'core/notices' );
3435

@@ -49,7 +50,7 @@ const useSettings = () => {
4950
setStatus( 'loaded' );
5051
setSettings( request );
5152
}
52-
}, []);
53+
}, [ settings ]);
5354

5455
/**
5556
* Get the value of the given option.
@@ -58,7 +59,7 @@ const useSettings = () => {
5859
* @returns {any} Option value.
5960
*/
6061
const getOption = option => {
61-
return settings?.[option];
62+
return updatedSettings?.[option] || settings?.[option];
6263
};
6364

6465
/**
@@ -105,6 +106,7 @@ const useSettings = () => {
105106
);
106107
}
107108

109+
updatedSettings = response;
108110
setSettings( response );
109111
onSuccess?.( response );
110112
});

0 commit comments

Comments
 (0)