@ontahi/react 1.0.0-alpha.16 → 1.0.0-alpha.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -51,6 +51,35 @@ const total = useGraphQuery(openTodos.count());
|
|
|
51
51
|
const first = useGraphQuery(openTodos.first());
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
+
Queries that depend on render values can be authored directly in the hook. `useGraphQuery` derives
|
|
55
|
+
its React Query key from the canonical graph program rather than the Query object's JavaScript
|
|
56
|
+
identity, so a fresh builder instance on each render does not require `useMemo` for correctness or
|
|
57
|
+
cache stability:
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
const todo = useGraphQuery(
|
|
61
|
+
TodoItem.all()
|
|
62
|
+
.where(todo => todo.id.eq(todoId))
|
|
63
|
+
.as(TodoListItem)
|
|
64
|
+
.one(),
|
|
65
|
+
);
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
When a dependency is not available yet, disable the read instead of inventing a sentinel locator:
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
const todo = useGraphQuery(
|
|
72
|
+
TodoItem.all()
|
|
73
|
+
.where(todo => todo.id.eq(todoId ?? ''))
|
|
74
|
+
.as(TodoListItem)
|
|
75
|
+
.one(),
|
|
76
|
+
{ enabled: Boolean(todoId) },
|
|
77
|
+
);
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Use a local Query variable when the same authored Query has multiple consumers. Reserve `useMemo`
|
|
81
|
+
for unusually expensive application-side query construction, not as routine hook ceremony.
|
|
82
|
+
|
|
54
83
|
`OntahiGraphProvider` installs a conventional same-origin Fetch client by default. Operation
|
|
55
84
|
invocation and permission, Graph Read, Graph Command, and Durable Operation inspection all use one
|
|
56
85
|
Runtime Transport at `POST /runtime`. Reflected Explorer data remains outside the registered
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ontahi/react",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.18",
|
|
4
4
|
"description": "Non-visual React hooks and bridge adapters for Ontahi applications",
|
|
5
5
|
"homepage": "https://github.com/javifernandes/ontahi/tree/main/packages/react",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"provenance": true
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@ontahi/core": "1.0.0-alpha.
|
|
43
|
+
"@ontahi/core": "1.0.0-alpha.18"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@tanstack/react-query": "^5.101.4",
|