File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
apps/builder/app/builder/features/settings-panel Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -51,10 +51,11 @@ export const SettingsSection = () => {
5151 placeholder = { placeholder }
5252 value = { localValue . value }
5353 onChange = { ( event ) => localValue . set ( event . target . value ) }
54- onBlur = { ( event ) => {
55- localValue . set ( ( event . target as HTMLInputElement ) . value . trim ( ) ) ;
56- localValue . save ;
57- } }
54+ onBlur = { ( event ) =>
55+ localValue . finalSave (
56+ ( event . target as HTMLInputElement ) . value . trim ( )
57+ )
58+ }
5859 />
5960 </ HorizontalLayout >
6061 </ Row >
Original file line number Diff line number Diff line change @@ -168,13 +168,20 @@ export const useLocalValue = <Type,>(
168168 onSaveRef . current = onSave ;
169169
170170 const save = ( ) => {
171+ console . info ( "save is triggered" ) ;
171172 isEditingRef . current = false ;
172173 if ( equal ( localValueRef . current , savedValue ) === false ) {
173174 // To synchronize with setState immediately followed by save
174175 onSaveRef . current ( localValueRef . current ) ;
175176 }
176177 } ;
177178
179+ const finalSave = ( value : Type ) => {
180+ localValueRef . current = value ;
181+ setRefresh ( ( refresh ) => refresh + 1 ) ;
182+ save ( ) ;
183+ } ;
184+
178185 const saveDebounced = useDebouncedCallback ( save , 500 ) ;
179186
180187 const setLocalValue = ( value : Type ) => {
@@ -224,6 +231,7 @@ export const useLocalValue = <Type,>(
224231 * Should be called on onBlur or similar event
225232 */
226233 save,
234+ finalSave,
227235 } ;
228236} ;
229237
You can’t perform that action at this time.
0 commit comments