Skip to content

Commit

Permalink
Fix visualization parameters not being updated
Browse files Browse the repository at this point in the history
  • Loading branch information
newcat committed Mar 3, 2024
1 parent c0379e3 commit fd3a550
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { createApp } from "vue";
import * as VueRouter from "vue-router";
import { createPinia } from "pinia";

import { wasmInterop } from "./wasmInterop";
import { initializeNativeAdapter } from "./native";
import "./utils/comlinkVueTransferHandler";

import "splitpanes/dist/splitpanes.css";
import "@baklavajs/themes/dist/syrup-dark.css";
Expand Down
1 change: 1 addition & 0 deletions src/stage/visualization/visualization.worker.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as Comlink from "comlink";
import "../../utils/comlinkVueTransferHandler";
import { StageRenderer } from "./stageRenderer";

console.log("Stage visualization worker started");
Expand Down
11 changes: 11 additions & 0 deletions src/utils/comlinkVueTransferHandler.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { isReactive } from "vue";
import * as Comlink from "comlink";

const vueReactiveTransferHandler: Comlink.TransferHandler<any, any> = {
canHandle: ((x: any) => {
return isReactive(x) || (x && typeof x === "object" && Object.values(x).some((v) => isReactive(v)));
}) as (x: any) => x is any,
serialize: (x) => [JSON.parse(JSON.stringify(x)), []],
deserialize: (x) => x,
};
Comlink.transferHandlers.set("VueReactiveValue", vueReactiveTransferHandler);

0 comments on commit fd3a550

Please sign in to comment.