@yogiswara/honcho-editor-ui 1.3.7 → 1.3.8
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.
|
@@ -356,26 +356,6 @@ export function useHonchoEditor(controller, initImageId, firebaseUid) {
|
|
|
356
356
|
imageList, currentImageId, hasNextPage,
|
|
357
357
|
isFetchingNextPage, currentPage, controller, firebaseUid, eventId
|
|
358
358
|
]);
|
|
359
|
-
useEffect(() => {
|
|
360
|
-
// This is now the single point of control for loading an image based on the initial props.
|
|
361
|
-
// 1. First, check if all conditions are met to even attempt loading.
|
|
362
|
-
// We ensure the editor itself is ready before doing anything.
|
|
363
|
-
const canLoad = initImageId && firebaseUid && controller && isEditorReady;
|
|
364
|
-
if (!canLoad) {
|
|
365
|
-
return;
|
|
366
|
-
}
|
|
367
|
-
// 2. Define the loading sequence as an async function inside the effect.
|
|
368
|
-
const loadInitialImage = async () => {
|
|
369
|
-
console.log(`[EFFECT] Starting to load initial image ID: ${initImageId}`);
|
|
370
|
-
// This directly calls the loading function. We don't need to set
|
|
371
|
-
// an intermediate 'currentImageId' state, which avoids an extra re-render and potential loop.
|
|
372
|
-
await loadImageFromId(firebaseUid, initImageId);
|
|
373
|
-
};
|
|
374
|
-
// 3. Execute the loading sequence.
|
|
375
|
-
loadInitialImage();
|
|
376
|
-
// Dependencies: The external props and readiness flags that trigger this logic.
|
|
377
|
-
// Whenever any of these change, this effect will re-evaluate.
|
|
378
|
-
}, [initImageId, firebaseUid, controller, isEditorReady, loadImageFromId]);
|
|
379
359
|
useEffect(() => {
|
|
380
360
|
const initialize = async () => {
|
|
381
361
|
if (initImageId && firebaseUid && controller && isEditorReady) {
|
|
@@ -415,14 +395,14 @@ export function useHonchoEditor(controller, initImageId, firebaseUid) {
|
|
|
415
395
|
};
|
|
416
396
|
initialize();
|
|
417
397
|
}, [initImageId, firebaseUid, controller, isEditorReady, loadImageFromId]);
|
|
418
|
-
useEffect(() => {
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
}, [currentImageId, isEditorReady]);
|
|
398
|
+
// useEffect(() => {
|
|
399
|
+
// // Ensure we have everything needed before trying to load.
|
|
400
|
+
// if (currentImageId && firebaseUid && controller && isEditorReady) {
|
|
401
|
+
// console.log(`[EFFECT] currentImageId changed to: ${currentImageId}. Loading new image into canvas.`);
|
|
402
|
+
// // Load the new image specified by the updated currentImageId
|
|
403
|
+
// loadImageFromId(firebaseUid, currentImageId);
|
|
404
|
+
// }
|
|
405
|
+
// }, [currentImageId, isEditorReady]);
|
|
426
406
|
const handleFileChange = (event) => {
|
|
427
407
|
const files = event.target?.files;
|
|
428
408
|
if (!files || files.length === 0)
|