Commit 88312f8
committed
fix(samples): await Native.* calls + drop broken svelteLogo reference
Sample-side bugs that surfaced once the merge brought main's plugin
chain in. Pre-existing in v2-new-samples, not caused by the merge:
1. Missing await on Native.method() — Comlink wraps the embind module
when it runs inside a worker (mt mode for the vite/webpack plugins,
and effectively for nuxt/next even in st because they instantiate
in a deferred context). All proxy calls return Promises, so the
v2-new-samples authoring pattern of `setMessage(Native.sample())`
rendered "[object Promise]" instead of the result.
Fixed in:
svelte-vite-mt/src/App.svelte
react-vite-mt/src/App.jsx
nuxt-vite/app/example.vue
nuxt-vite-mt/app/example.vue
next-webpack-mt/app/page.tsx
remix-vite/app/welcome/welcome.tsx
2. svelte-vite-mt/src/App.svelte referenced an undefined `svelteLogo`
binding (the import was missing and there's no svelte logo asset
in the package). Removed the <div class="logo">…</div> block —
it caused the whole component to render blank in Svelte 5.
For mt samples the thread-result poll also moved into setTimeout's
async callback so getThreadResult() actually completes before being
assigned (previously it raced runOnThread()).
Verified end-to-end: every listed sample renders the matrix result
in the browser.1 parent 7294e3f commit 88312f8
6 files changed
Lines changed: 28 additions & 27 deletions
File tree
- cppjs-samples
- cppjs-sample-web-next-webpack-multithread/app
- cppjs-sample-web-nuxt-vite-multithread/app
- cppjs-sample-web-nuxt-vite/app
- cppjs-sample-web-react-vite-multithread/src
- cppjs-sample-web-remix-vite/app/welcome
- cppjs-sample-web-svelte-vite-multithread/src
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | | - | |
25 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | | - | |
18 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
Lines changed: 7 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
12 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
13 | 13 | | |
14 | | - | |
15 | | - | |
| 14 | + | |
| 15 | + | |
16 | 16 | | |
17 | | - | |
18 | | - | |
| 17 | + | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
| 10 | + | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
Lines changed: 7 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
10 | 10 | | |
11 | | - | |
12 | | - | |
| 11 | + | |
| 12 | + | |
13 | 13 | | |
14 | | - | |
15 | | - | |
| 14 | + | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | 21 | | |
25 | 22 | | |
26 | 23 | | |
| |||
0 commit comments