Nadro/4857/wasm panic catching errors (#4901)

* chore: skeleton code to initialize and detect the global WASM panic

* chore: implementing a reimport method to fix the wasm instance being bricked

* fix: cleaning up tsc/lint

* fix: renaming file to be more accurate

* fix: added toast message

* fix: types...

* fix: typed the functions with arg spreads
This commit is contained in:
Kevin Nadro
2025-01-08 10:58:41 -05:00
committed by GitHub
parent 28b5f7080c
commit 029f76f273
5 changed files with 186 additions and 2 deletions

View File

@ -1,4 +1,5 @@
import init, {
import {
init,
parse_wasm,
recast_wasm,
execute,
@ -16,7 +17,9 @@ import init, {
default_project_settings,
base64_decode,
clear_scene_and_bust_cache,
} from '../wasm-lib/pkg/wasm_lib'
reloadModule,
} from 'lib/wasm_lib_wrapper'
import { KCLError } from './errors'
import { KclError as RustKclError } from '../wasm-lib/kcl/bindings/KclError'
import { EngineCommandManager } from './std/engineConnection'
@ -144,6 +147,7 @@ export const wasmUrl = () => {
// Initialise the wasm module.
const initialise = async () => {
try {
await reloadModule()
const fullUrl = wasmUrl()
const input = await fetch(fullUrl)
const buffer = await input.arrayBuffer()