Skip to content

Commit 64c873f

Browse files
echarlessok82Sergey Kadnikov
authored
docs: context and state (#303)
* docs: context and state * Handling uncaught runtime error in promise when executing code in output (#302) * Added notifyOnComplete paramater for code execution enabling to send model notifications only when all code execution completed * Fixed missing metadata parameter for OutputExecutor * Fixed JSONObject initialization * Fixed uncaught runtime exception in promise when code execution error occurs in Output --------- Co-authored-by: Sergey Kadnikov <skadnikov@seeneco.ru> * bump: version --------- Co-authored-by: Sok82 Developer <developer.d20@gmail.com> Co-authored-by: Sergey Kadnikov <skadnikov@seeneco.ru>
1 parent edb0265 commit 64c873f

File tree

5 files changed

+41
-15
lines changed

5 files changed

+41
-15
lines changed

docs/docs/components/context/index.mdx

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,30 @@
22
description: The Context component.
33
---
44

5-
# 🪐 Jupyter Context
5+
# 🪐 Context
66

7-
Every component must be wrapped inside a Jupyter Context.
7+
Every component should be wrapped inside a Context to get the needed CSS.
8+
9+
```tsx
10+
root.render(
11+
<JupyterLabTheme>
12+
<Cell />
13+
</Jupyter>
14+
);
15+
```
16+
17+
If you prefer to not wrap in a Context, you can just use the JupyterLabCss component.
18+
19+
```tsx
20+
root.render(
21+
<>
22+
<JupyterLabCss colorMode='dark' />
23+
<Cell />
24+
</>
25+
);
26+
```
27+
28+
We also have a more evolved Context that allows you to specify behaviour for the kernels.
829

930
```tsx
1031
root.render(
@@ -30,10 +51,11 @@ The Jupyter Context has the following properties.
3051

3152
- `collaborative`
3253
- `defaultKernelName`
33-
- `injectableStore`: Read more about the [State](/docs/state)
54+
- `injectableStore` - Read more about the [State](/docs/state)
3455
- `jupyterServerUrl` - Read also [Deployment](/docs/deployments/jupyter-server)
3556
- `jupyterServerToken` - Read also [Deployment](/docs/deployments/jupyter-server)
36-
- `lite`
57+
- `initCode` - The code to run on the Kernel when it is ready.
58+
- `lite` - Use a pyodide (in browser) Kernel.
3759
- `loadJupyterCss`
3860
- `startDefaultKernel`
3961
- `terminals`

docs/docs/state/index.mdx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ sidebar_position: 1
77

88
As an application developer, you may already have a Redux store. You can simply inject the Jupyter UI store in your own store.
99

10-
For now, we support [Redux](/docs/state/redux) to manage the application state.
10+
For now, we support [Zustand](/docs/state/zustand) to manage the application state.
1111

12-
We are considering other stores like `Mobx` or `Zustand`, please share thoughts and requirements on [this issue](https://github.com/datalayer/jupyter-ui/issues/50).
12+
## Deprecated Redux
13+
14+
We have been considering other stores like `Mobx`, please share thoughts and requirements on [this issue](https://github.com/datalayer/jupyter-ui/issues/50).
15+
16+
Redux was harder to play with, see e.g. the [Notebook Injectable Redux Store example](https://github.com/datalayer/jupyter-ui/tree/14e45c0928f724d2899d0f031e1d9451886df624/packages/react/src/examples/NotebookInjectableReduxStore.tsx) to inject your own Redux state, reducers and epics in the Jupyter React Redux store.

docs/docs/state/redux.mdx

Lines changed: 0 additions & 8 deletions
This file was deleted.

docs/docs/state/zustand.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: Zustand State
3+
sidebar_position: 1
4+
---
5+
6+
## Zustand State
7+
8+
Zustand State.

packages/react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@datalayer/jupyter-react",
3-
"version": "0.18.4",
3+
"version": "0.18.5",
44
"description": "Jupyter React - React.js components 100% compatible with Jupyter.",
55
"license": "MIT",
66
"main": "lib/index.js",

0 commit comments

Comments
 (0)