Skip to content

Commit

Permalink
fix: QA issues
Browse files Browse the repository at this point in the history
  • Loading branch information
HardeepAsrani authored Nov 21, 2023
1 parent d37e150 commit 25efcd0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/blocks/helpers/use-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { useState } from '@wordpress/element';
* @returns {[(optionName: string) => any, (option: string, value: any, success?: string, noticeId?: string, onSuccess: Function) => void, 'loading' | 'loaded' | 'error' | 'saving']} [ getOption, updateOption, status ]
*
*/
let updatedSettings = {};
const useSettings = () => {
const { createNotice } = dispatch( 'core/notices' );

Expand All @@ -49,7 +50,7 @@ const useSettings = () => {
setStatus( 'loaded' );
setSettings( request );
}
}, []);
}, [ settings ]);

/**
* Get the value of the given option.
Expand All @@ -58,7 +59,7 @@ const useSettings = () => {
* @returns {any} Option value.
*/
const getOption = option => {
return settings?.[option];
return updatedSettings?.[option] || settings?.[option];
};

/**
Expand Down Expand Up @@ -105,6 +106,7 @@ const useSettings = () => {
);
}

updatedSettings = response;
setSettings( response );
onSuccess?.( response );
});
Expand Down

0 comments on commit 25efcd0

Please sign in to comment.