You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Brings in two content-only commits that landed on develop after the
last sync:
- 0e047ee docs: fix SSR section framing in React integration guide (#1688)
- 79f2f15 docs: rewrite Vue integration guide around markRaw pattern (#1689)
Both touch files we migrated from `docs/guide/` to
`docs/src/content/docs/guide/`. Git's rename detection auto-applied
the develop-side edits to the new locations — no conflicts.
GitHub had flagged the PR as CONFLICTING because its mergeability check
hadn't recomputed since develop's last push; pushing this merge clears
that flag.
Copy file name to clipboardExpand all lines: docs/src/content/docs/guide/integration-with-react.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,10 @@ The HyperFormula API is identical in a React app and in plain JavaScript. This g
7
7
8
8
Install with `npm install hyperformula`. For other options, see the [client-side installation](/docs/guide/client-side-installation) section.
9
9
10
+
::: tip TypeScript
11
+
All examples use TypeScript. Remove the type annotations to use plain JavaScript.
12
+
:::
13
+
10
14
## Basic usage
11
15
12
16
Hold the HyperFormula instance in a `useRef` so it survives re-renders. Initialize it inside `useEffect` and release it in the cleanup function. Use `useState` to toggle between raw formulas and computed values.
@@ -70,15 +74,13 @@ export default function SpreadsheetComponent() {
70
74
}
71
75
```
72
76
73
-
If you use JavaScript instead of TypeScript, drop the type annotations — the rest of the pattern is unchanged.
74
-
75
77
## `React.StrictMode` double invocation
76
78
77
79
In development, React runs effects twice (mount → unmount → mount) to surface cleanup bugs. The pattern above is correct for StrictMode because `destroy()` runs before the re-mount creates a new instance, so no work leaks between the two lifecycles. Do not switch to a module-scoped singleton as a workaround — it will break StrictMode semantics.
78
80
79
81
## Server-side rendering (Next.js App Router)
80
82
81
-
The component above is already SSR-safe — the engine is constructed in `useEffect`, which never runs on the server. If you still want to skip the initial bundle on the server (it is a few hundred kB), wrap it in a client-only dynamic import.
83
+
The component above is already SSR-safe — the engine is constructed in `useEffect`, which never runs on the server. If you still want to keep HyperFormula out of the initial JS bundle sent to the browser (it is a few hundred kB), wrap it in a client-only dynamic import.
82
84
83
85
In the App Router, `dynamic(..., { ssr: false })` is only allowed inside a client component. Put the dynamic call in a `'use client'` wrapper and import the wrapper from your server page:
Copy file name to clipboardExpand all lines: docs/src/content/docs/guide/integration-with-vue.md
+31-51Lines changed: 31 additions & 51 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,67 +7,47 @@ The HyperFormula API is identical in a Vue 3 app and in plain JavaScript. This g
7
7
8
8
Install with `npm install hyperformula`. For other options, see the [client-side installation](/docs/guide/client-side-installation) section.
9
9
10
-
## Basic usage
11
-
12
-
Wrap the HyperFormula instance inside a plain class so it stays outside Vue's reactivity system (see [Troubleshooting](#vue-reactivity-issues) below for why this matters). Hold derived data in `ref` so the template updates when you reassign the ref's `.value`.
10
+
::: tip TypeScript
11
+
All examples use TypeScript. Remove the type annotations to use plain JavaScript.
returnthis.hf.getSheetSerialized(0) as (string|number|null)[][];
34
-
}
35
-
36
-
destroy() {
37
-
this.hf.destroy();
38
-
}
39
-
}
40
-
```
14
+
## Basic usage
41
15
42
-
Use the class from a component with `<script setup>`:
16
+
Pass the HyperFormula instance through Vue's [`markRaw`](https://vuejs.org/api/reactivity-advanced.html#markraw) to opt it out of the reactivity system (see [Troubleshooting](#vue-reactivity-issues) below for why this matters). Hold derived data in `ref` so the template updates when you reassign the ref's `.value`.
43
17
44
18
```vue
45
19
<script setup lang="ts">
46
-
import { onUnmounted, ref } from 'vue';
47
-
import type { CellValue } from 'hyperformula';
48
-
import { SpreadsheetProvider } from './spreadsheet-provider';
49
-
50
-
const provider = new SpreadsheetProvider([
51
-
[1, 2, '=A1+B1'],
52
-
// your data rows go here
53
-
]);
20
+
import { markRaw, onUnmounted, ref } from "vue";
21
+
import { HyperFormula, type CellValue } from "hyperformula";
The class keeps the HyperFormula instance as a private field, so Vue's reactivity Proxy never reaches it. This is the same pattern used in the [Vue 3 demo](#demo).
59
+
`hf` is marked raw so Vue never proxies it — `values` is the only reactive piece. To mutate data, call any HyperFormula method (e.g. `setCellContents`) then reassign `values.value` to trigger a re-render. See [Basic operations](basic-operations.md) for the full mutation API.
80
60
81
61
## Server-side rendering (Nuxt)
82
62
83
-
The class above is already SSR-safe — HyperFormula has no browser-only API dependency. To skip the (otherwise wasted) server-side instantiation in Nuxt, wrap the component with `<ClientOnly>`.
63
+
HyperFormula has no browser-only API dependency. To skip server-side computation, wrap the component with `<ClientOnly>`.
84
64
85
65
## Troubleshooting
86
66
@@ -92,16 +72,16 @@ If you encounter an error like
92
72
Uncaught TypeError: Cannot read properties of undefined (reading 'licenseKeyValidityState')
93
73
```
94
74
95
-
it means that Vue's reactivity system tried to deeply observe the HyperFormula instance. Vue wraps reactive objects in a `Proxy` that intercepts every property access; when that proxy reaches a non-trivial instance with its own internal state, identity checks and lazy-initialized maps break. The fix is to opt the instance out of reactivity with Vue's [`markRaw`](https://vuejs.org/api/reactivity-advanced.html#markraw):
75
+
it means that Vue's reactivity system tried to deeply observe the HyperFormula instance. Vue wraps reactive objects in a `Proxy` that intercepts every property access; when that proxy reaches a non-trivial instance with its own internal state, identity checks and lazy-initialized maps break. The fix is to opt the instance out of reactivity with [`markRaw`](https://vuejs.org/api/reactivity-advanced.html#markraw):
0 commit comments