@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.js CHANGED
@@ -2215,6 +2215,7 @@ 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);
2218
2219
  useEffect(() => {
2219
2220
  setIsLoading(true);
2220
2221
  const fetchScene = async () => {
@@ -2460,18 +2461,14 @@ function useScriptBreakdownScene(options) {
2460
2461
  }, [options.preLoadedTags]);
2461
2462
  useEffect(() => {
2462
2463
  const doBulkCreate = async () => {
2463
- if (blocks.length > 0 && !autoTaggedSceneRef.current) {
2464
- const hasPreloadedTags = options.preLoadedTags && options.preLoadedTags.length > 0;
2465
- if (hasPreloadedTags) {
2466
- autoTaggedSceneRef.current = options.scene_url;
2467
- return;
2468
- }
2469
- autoTaggedSceneRef.current = options.scene_url;
2470
- await bulkCreateTags();
2471
- }
2464
+ if (blocks.length === 0 || hasInitializedRef.current) return;
2465
+ const hasPreloadedTags = options.preLoadedTags && options.preLoadedTags.length > 0;
2466
+ hasInitializedRef.current = true;
2467
+ if (hasPreloadedTags) return;
2468
+ await bulkCreateTags();
2472
2469
  };
2473
2470
  doBulkCreate();
2474
- }, [blocks, options.scene_url, options.preLoadedTags, bulkCreateTags]);
2471
+ }, [blocks, options.scene_url, options.preLoadedTags]);
2475
2472
  const clearSelection = useCallback(() => {
2476
2473
  var _a;
2477
2474
  setSelectionMenu(null);