@vishu1301/script-writing 1.2.6 → 1.2.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.
package/dist/index.d.cts CHANGED
@@ -128,6 +128,7 @@ interface UseScriptBreakdownSceneOptions {
128
128
  onTagRemoved?: (tagId: string) => void;
129
129
  onTagUpdated?: (tagId: string, categoryId: ElementCategory) => void;
130
130
  preLoadedTags?: Tag[];
131
+ preLoadedTagsLoading?: boolean;
131
132
  }
132
133
  declare function useScriptBreakdownScene(options: UseScriptBreakdownSceneOptions): {
133
134
  scene: any;
package/dist/index.d.ts CHANGED
@@ -128,6 +128,7 @@ interface UseScriptBreakdownSceneOptions {
128
128
  onTagRemoved?: (tagId: string) => void;
129
129
  onTagUpdated?: (tagId: string, categoryId: ElementCategory) => void;
130
130
  preLoadedTags?: Tag[];
131
+ preLoadedTagsLoading?: boolean;
131
132
  }
132
133
  declare function useScriptBreakdownScene(options: UseScriptBreakdownSceneOptions): {
133
134
  scene: any;
package/dist/index.js CHANGED
@@ -2215,7 +2215,6 @@ function useScriptBreakdownScene(options) {
2215
2215
  const [isLoading, setIsLoading] = useState(true);
2216
2216
  const [error, setError] = useState(false);
2217
2217
  const menuRef = useRef(null);
2218
- const hasInitializedRef = useRef(false);
2219
2218
  useEffect(() => {
2220
2219
  setIsLoading(true);
2221
2220
  const fetchScene = async () => {
@@ -2461,14 +2460,21 @@ function useScriptBreakdownScene(options) {
2461
2460
  }, [options.preLoadedTags]);
2462
2461
  useEffect(() => {
2463
2462
  const doBulkCreate = async () => {
2464
- if (blocks.length === 0 || hasInitializedRef.current) return;
2463
+ if (blocks.length === 0) return;
2464
+ if (options.preLoadedTagsLoading) return;
2465
+ if (autoTaggedSceneRef.current === options.scene_url) return;
2465
2466
  const hasPreloadedTags = options.preLoadedTags && options.preLoadedTags.length > 0;
2466
- hasInitializedRef.current = true;
2467
+ autoTaggedSceneRef.current = options.scene_url;
2467
2468
  if (hasPreloadedTags) return;
2468
2469
  await bulkCreateTags();
2469
2470
  };
2470
2471
  doBulkCreate();
2471
- }, [blocks, options.scene_url, options.preLoadedTags]);
2472
+ }, [
2473
+ blocks,
2474
+ options.scene_url,
2475
+ options.preLoadedTags,
2476
+ options.preLoadedTagsLoading
2477
+ ]);
2472
2478
  const clearSelection = useCallback(() => {
2473
2479
  var _a;
2474
2480
  setSelectionMenu(null);