Skip to content

Commit a9d86fe

Browse files
fix: made some changes to fix in issue (#4729)
1 parent 88008e0 commit a9d86fe

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

apps/builder/app/builder/features/settings-panel/settings-section.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff 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>

apps/builder/app/builder/features/settings-panel/shared.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)