@vishu1301/script-writing 1.4.0 → 1.4.1

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
@@ -2823,9 +2823,7 @@ function useScriptBreakdownScene(options) {
2823
2823
  await ((_d = options.onTagUpdated) == null ? void 0 : _d.call(options, id, categoryId || null, details));
2824
2824
  } catch (error2) {
2825
2825
  console.error("Failed to update tag:", error2);
2826
- setTags(
2827
- (prev) => prev.map((t) => t.id === id ? tagToUpdate : t)
2828
- );
2826
+ setTags((prev) => prev.map((t) => t.id === id ? tagToUpdate : t));
2829
2827
  }
2830
2828
  };
2831
2829
  return {
@@ -4472,7 +4470,7 @@ function ShotBreakdownView({
4472
4470
  );
4473
4471
  }
4474
4472
  function useShotBreakdownScene(options) {
4475
- const [shots, setShots] = react.useState(options.preLoadedShots || []);
4473
+ const [shots, setShots] = react.useState(options.preloadedShots || []);
4476
4474
  const [cameras, setCameras] = react.useState(
4477
4475
  options.preloadedCameras || []
4478
4476
  );
@@ -4484,6 +4482,34 @@ function useShotBreakdownScene(options) {
4484
4482
  const [error, setError] = react.useState(false);
4485
4483
  const [selectionMenu, setSelectionMenu] = react.useState(null);
4486
4484
  const menuRef = react.useRef(null);
4485
+ react.useEffect(() => {
4486
+ if (options.preloadedShots && options.preloadedShots.length > 0) {
4487
+ setShots((prev) => {
4488
+ if (JSON.stringify(prev) === JSON.stringify(options.preloadedShots)) {
4489
+ return prev;
4490
+ }
4491
+ return options.preloadedShots || [];
4492
+ });
4493
+ }
4494
+ }, [options.preloadedShots]);
4495
+ react.useEffect(() => {
4496
+ if (options.preloadedCameras && options.preloadedCameras.length > 0) {
4497
+ setCameras((prev) => {
4498
+ if (JSON.stringify(prev) === JSON.stringify(options.preloadedCameras)) {
4499
+ return prev;
4500
+ }
4501
+ return options.preloadedCameras || [];
4502
+ });
4503
+ }
4504
+ }, [options.preloadedCameras]);
4505
+ react.useEffect(() => {
4506
+ if (options.preloadedSceneType) {
4507
+ setSceneType((prev) => {
4508
+ if (prev === options.preloadedSceneType) return prev;
4509
+ return options.preloadedSceneType || "";
4510
+ });
4511
+ }
4512
+ }, [options.preloadedSceneType]);
4487
4513
  react.useEffect(() => {
4488
4514
  setIsLoading(true);
4489
4515
  const fetchScene = async () => {