Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
76d734d
docs: document Signal class for v2
bowheart Jul 23, 2025
3b226d1
docs: document `injectSignal` injector for v2
bowheart Jul 23, 2025
25f5442
docs: document `ZeduxNode` class for v2
bowheart Jul 23, 2025
b85ec47
docs: document `AtomInstance` class for v2
bowheart Jul 23, 2025
dda386e
docs: document `Ecosystem` class for v2
bowheart Jul 24, 2025
7399aa8
docs: document `AtomTemplate` class for v2
bowheart Jul 24, 2025
8feebc5
docs: document glossary for v2
bowheart Jul 24, 2025
08ab6e6
docs: document `atom` factory for v2
bowheart Jul 24, 2025
15ab275
docs: document `AtomApi` class for v2
bowheart Jul 24, 2025
cd3e5c1
docs: document `api` factory for v2
bowheart Jul 24, 2025
98223ed
docs: document `SelectorInstance` class for v2
bowheart Jul 24, 2025
142c2f6
docs: document `AtomProvider` component for v2
bowheart Jul 24, 2025
66a18e6
docs: document `EcosystemProvider` component for v2
bowheart Jul 24, 2025
a653a5e
docs: document `ion` factory for v2
bowheart Jul 24, 2025
a4bc835
docs: document `MappedSignal` class for v2
bowheart Jul 24, 2025
040c9b2
docs: document `useEcosystem` hook for v2
bowheart Jul 24, 2025
81d257f
docs: document `createEcosystem` factory for v2
bowheart Jul 24, 2025
ecf9bd9
docs: document `injectEcosystem` injector for v2
bowheart Jul 24, 2025
2a4365c
docs: document `useAtomContext` hook for v2
bowheart Jul 24, 2025
4f03145
docs: document `useAtomInstance` hook for v2
bowheart Jul 24, 2025
09f5137
docs: document `useAtomSelector` hook for v2
bowheart Jul 25, 2025
f4797fc
docs: document `SelectorTemplate` type for v2
bowheart Jul 25, 2025
6a96082
docs: document `useAtomState` hook for v2
bowheart Jul 25, 2025
12d4322
docs: document `useAtomValue` hook for v2
bowheart Jul 25, 2025
f4b616f
docs: document `injectAtomInstance` for v2
bowheart Jul 25, 2025
df53ac7
docs: document `injectAtomState` injector for v2
bowheart Jul 25, 2025
95aaf09
docs: document `injectAtomValue` injector for v2
bowheart Jul 25, 2025
97b1ea9
docs: document `injectCallback` injector for v2
bowheart Jul 25, 2025
94d8f41
docs: document `injectEffect` injector for v2
bowheart Jul 31, 2025
e9e1309
docs: document `injectHydration` injector for v2
bowheart Aug 1, 2025
9b64c91
docs: document `injectMappedSignal` for v2
bowheart Aug 4, 2025
e261b14
docs: document `injectMemo` for v2
bowheart Aug 5, 2025
71368db
docs: document `injectPromise` for v2
bowheart Nov 7, 2025
6dbc2af
update /not-done injectPromise links
bowheart Nov 7, 2025
5b5d326
fix pnpm-lock zedux v1 peer deps
bowheart Nov 15, 2025
4ad17cc
docs: document `injectRef` for v2
bowheart Nov 15, 2025
0dd2766
update /not-done paths for `injectRef`
bowheart Nov 15, 2025
9bdb2c3
docs: document `injectSelf` for v2
bowheart Nov 15, 2025
efbe060
some tweaks
bowheart Nov 15, 2025
ec91a3a
docs: document `injectWhy` for v2
bowheart Nov 15, 2025
767885f
docs: document the `AtomConfig` type for v2
bowheart Nov 15, 2025
6f7583b
docs: document the new `inject` util
bowheart Nov 15, 2025
eca6cc0
docs: document the new `As` util
bowheart Nov 15, 2025
50a0921
docs: document the new `getDefaultEcosystem` util for v2
bowheart Nov 15, 2025
89cd2b2
docs: document `getInternals` for v2
bowheart Nov 15, 2025
3413f6a
docs: document `is` util for v2
bowheart Nov 16, 2025
2f720fc
docs: document `setInternals` for v2
bowheart Nov 16, 2025
6d61266
docs: document new `untrack` util
bowheart Nov 16, 2025
3f36920
docs: rework selector types documentation; add some page placeholders
bowheart Nov 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
docs: document setInternals for v2
  • Loading branch information
bowheart committed Nov 16, 2025
commit 2f720fc006342ad524d1b6459b7820f0fe49ff11
4 changes: 2 additions & 2 deletions docs/docs/v2/api/utils/getInternals.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ A utility function that returns Zedux's internal state. This is primarily used f
This is an advanced utility that exposes Zedux internals. Use with caution and only when necessary.
:::

Pass the returned internals object to [`setInternals`](/not-done?path=./setInternals.mdx) e.g. in a child window or iframe to share state between multiple Zedux instances. Note that you'll typically want to share your [ecosystem(s)](../classes/Ecosystem.mdx) as well.
Pass the returned internals object to [`setInternals`](./setInternals.mdx) e.g. in a child window or iframe to share state between multiple Zedux instances. Note that you'll typically want to share your [ecosystem(s)](../classes/Ecosystem.mdx) as well.

## Example

Expand Down Expand Up @@ -55,4 +55,4 @@ function App() {

## See Also

- [The `setInternals` utility](/not-done?path=./setInternals.mdx)
- [The `setInternals` utility](./setInternals.mdx)
72 changes: 72 additions & 0 deletions docs/docs/v2/api/utils/setInternals.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
id: setInternals
title: setInternals
---

import { Legend, Item, Link, Tabs, Ts, tab1, tab2 } from '@site/src/all'

```ts
import { setInternals } from '@zedux/react'
```

A utility function that sets Zedux's internal state to the state previously retrieved from [`getInternals`](./getInternals.mdx). This is primarily used for sharing state between multiple Zedux instances, such as in child windows or iframe scenarios.

:::warning Advanced Usage
This is an advanced utility that modifies Zedux internals. Use with caution and only when necessary.
:::

## Example

```ts
// in the parent window:
import { getInternals } from '@zedux/react'

window.getZeduxInternals = getInternals

// In a child window:
const parentInternals = window.opener.getZeduxInternals()
setInternals(parentInternals)

// Now the Zedux instance in this window shares its internal state with the
// parent window's Zedux instance.
```

If you're using the [default ecosystem](../classes/Ecosystem.mdx#default-ecosystem), this is all you need to do to share all your state across windows. But when using custom ecosystems, you'll typically want to share that across windows as well:

```tsx
// in the parent window:
import { createEcosystem } from '@zedux/react'

window.rootEcosystem = createEcosystem()

// In a child window:
const rootEcosystem = window.opener.rootEcosystem

// And use it as normal, e.g. providing it to an <EcosystemProvider>:
function ChildWindow() {
return (
<EcosystemProvider ecosystem={rootEcosystem}>
<Routes />
</EcosystemProvider>
)
}
```

<Tabs>
{tab1(`setInternals = (internals) => void`)}
{tab2(`declare const setInternals: (internals: {
c: EvaluationContext
g: Ecosystem
}) => void`)}
</Tabs>

<Legend>
<Item name="internals">
Required. An internals object previously retrieved from
[`getInternals()`](./getInternals.mdx).
</Item>
</Legend>

## See Also

- [The `getInternals` utility](./getInternals.mdx)
1 change: 1 addition & 0 deletions docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ module.exports = {
'v2/api/utils/getInternals',
'v2/api/utils/inject',
'v2/api/utils/is',
'v2/api/utils/setInternals',
],
},
'v2/api/glossary',
Expand Down