@yogiswara/honcho-editor-ui 2.3.5 → 2.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks/usePreset.js +11 -5
- package/package.json +1 -1
package/dist/hooks/usePreset.js
CHANGED
|
@@ -74,18 +74,24 @@ export function usePreset(controller, firebaseUid, options = {}) {
|
|
|
74
74
|
}
|
|
75
75
|
setIsLoading(true);
|
|
76
76
|
setError(null);
|
|
77
|
+
console.log('before GOINT to load 2.5. STATE UPDATE: setPresets is being called with:', presets);
|
|
77
78
|
try {
|
|
78
79
|
debugLog('Loading presets from backend...');
|
|
79
80
|
const loadedPresets = await controllerRef.current.getPresets(firebaseUidRef.current);
|
|
81
|
+
console.log('✅ 3. STATE UPDATE: setPresets is being called with:', loadedPresets);
|
|
80
82
|
setPresets(loadedPresets);
|
|
83
|
+
console.log('✅ 4. STATE UPDATE: setIsInitialized is being called with:', true);
|
|
84
|
+
console.log('presets thats called:', presets);
|
|
81
85
|
setIsInitialized(true);
|
|
82
86
|
debugLog('Presets loaded successfully', { count: loadedPresets.length });
|
|
83
87
|
}
|
|
84
88
|
catch (err) {
|
|
85
89
|
handleError('load presets', err);
|
|
90
|
+
console.log('4. catch ERROR!');
|
|
86
91
|
setPresets([]); // Clear presets on error
|
|
87
92
|
}
|
|
88
93
|
finally {
|
|
94
|
+
console.log('5. STATE UPDATE: setIsLoading is being called with:', false);
|
|
89
95
|
setIsLoading(false);
|
|
90
96
|
}
|
|
91
97
|
}, [debugLog, handleError]);
|
|
@@ -153,10 +159,10 @@ export function usePreset(controller, firebaseUid, options = {}) {
|
|
|
153
159
|
// Add the new preset to the local state immediately
|
|
154
160
|
setPresets(prev => [...prev, newPreset]);
|
|
155
161
|
// Fire and forget: Schedule a delayed refresh to get updated preset list
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
162
|
+
setTimeout(() => {
|
|
163
|
+
debugLog('Refreshing presets after create (fire and forget)');
|
|
164
|
+
loadInBackground();
|
|
165
|
+
}, 500); // 500ms delay to allow backend processing
|
|
160
166
|
// Return a minimal success indicator since we don't have the actual preset data
|
|
161
167
|
// return { id: 'pending', name, is_default: false } as Preset;
|
|
162
168
|
return newPreset;
|
|
@@ -169,7 +175,7 @@ export function usePreset(controller, firebaseUid, options = {}) {
|
|
|
169
175
|
setIsLoading(false);
|
|
170
176
|
}
|
|
171
177
|
// loadInBackground
|
|
172
|
-
}, [presets, debugLog, handleError]);
|
|
178
|
+
}, [presets, debugLog, handleError, loadInBackground]);
|
|
173
179
|
// Rename an existing preset
|
|
174
180
|
const rename = useCallback(async (presetId, newName) => {
|
|
175
181
|
if (!controllerRef.current || !firebaseUidRef.current) {
|