merged and added the layout
This commit is contained in:
@@ -7,15 +7,18 @@ import SimulationHandler from "./SimulationHandler";
|
||||
import { useParams } from "react-router-dom";
|
||||
import { getSimulationData, saveSimulationData } from "../../../components/layout/scenes/functions/simulationStorage";
|
||||
import { useSimulationManager } from "../../../store/rough/useSimulationManagerStore";
|
||||
import { useSimulateId } from "../../../store/builder/store";
|
||||
|
||||
function Simulator() {
|
||||
const { productStore,versionStore } = useSceneContext();
|
||||
const { productStore, versionStore } = useSceneContext();
|
||||
const { products, getProductById, selectedProduct } = productStore();
|
||||
const { handleAction } = useActionHandler();
|
||||
const { isPlaying } = usePlayButtonStore();
|
||||
const { isReset } = useResetButtonStore();
|
||||
const { projectId } = useParams();
|
||||
const { selectedVersion } = versionStore();
|
||||
const { setSimulateId } = useSimulateId();
|
||||
const { addSimulationRecords } = useSimulationManager();
|
||||
|
||||
useEffect(() => {
|
||||
if (!isPlaying || isReset || !selectedProduct.productUuid) return;
|
||||
@@ -37,7 +40,17 @@ function Simulator() {
|
||||
if (!product) return;
|
||||
const products: productsSchema = [product];
|
||||
const getSimulate = getData?.data;
|
||||
console.log("getSimulate: ", getSimulate);
|
||||
if (getData && getSimulate && getSimulate.productTimestamp === products[0]?.timestamp) {
|
||||
setSimulateId(getSimulate._id);
|
||||
console.log(" getSimulate.data: ", getSimulate.data);
|
||||
addSimulationRecords(
|
||||
projectId,
|
||||
selectedVersion?.versionId || "",
|
||||
selectedProduct?.productUuid || "",
|
||||
getSimulate.data // ✅ this is already an array
|
||||
);
|
||||
echo.log("Simulation data is up to date");
|
||||
return;
|
||||
} else {
|
||||
//call create API
|
||||
|
||||
Reference in New Issue
Block a user