@vishu1301/script-writing 1.2.5 → 1.2.6

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/index.cjs CHANGED
@@ -2240,6 +2240,7 @@ function useScriptBreakdownScene(options) {
2240
2240
  const [isLoading, setIsLoading] = react.useState(true);
2241
2241
  const [error, setError] = react.useState(false);
2242
2242
  const menuRef = react.useRef(null);
2243
+ const hasInitializedRef = react.useRef(false);
2243
2244
  react.useEffect(() => {
2244
2245
  setIsLoading(true);
2245
2246
  const fetchScene = async () => {
@@ -2485,18 +2486,14 @@ function useScriptBreakdownScene(options) {
2485
2486
  }, [options.preLoadedTags]);
2486
2487
  react.useEffect(() => {
2487
2488
  const doBulkCreate = async () => {
2488
- if (blocks.length > 0 && !autoTaggedSceneRef.current) {
2489
- const hasPreloadedTags = options.preLoadedTags && options.preLoadedTags.length > 0;
2490
- if (hasPreloadedTags) {
2491
- autoTaggedSceneRef.current = options.scene_url;
2492
- return;
2493
- }
2494
- autoTaggedSceneRef.current = options.scene_url;
2495
- await bulkCreateTags();
2496
- }
2489
+ if (blocks.length === 0 || hasInitializedRef.current) return;
2490
+ const hasPreloadedTags = options.preLoadedTags && options.preLoadedTags.length > 0;
2491
+ hasInitializedRef.current = true;
2492
+ if (hasPreloadedTags) return;
2493
+ await bulkCreateTags();
2497
2494
  };
2498
2495
  doBulkCreate();
2499
- }, [blocks, options.scene_url, options.preLoadedTags, bulkCreateTags]);
2496
+ }, [blocks, options.scene_url, options.preLoadedTags]);
2500
2497
  const clearSelection = react.useCallback(() => {
2501
2498
  var _a;
2502
2499
  setSelectionMenu(null);