@diagonal-hq/pages 0.3.5 → 0.4.0

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +13 -2
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -6542,7 +6542,7 @@ export type SdkHooks = {
6542
6542
  * Keys are isolated from the app's other React Query caches. Begin a key with
6543
6543
  * `'records'` when the endpoint's result depends on resource records, for example
6544
6544
  * `['records', resource.id, 'summary']`; successful resource create/update/delete/restore
6545
- * operations then invalidate it automatically. Other keys refresh only through their
6545
+ * operations and record form submits then invalidate it automatically. Other keys refresh only through their
6546
6546
  * returned `invalidate` function.
6547
6547
  *
6548
6548
  * Keep the key the same between renders. A clock read such as `Date.now()` in the key
@@ -7781,6 +7781,9 @@ export type SdkHooks = {
7781
7781
  * `form.errors` contains only 422 field validation. Other failures are available
7782
7782
  * as `form.failure`; for example, branch on
7783
7783
  * `Sdk.utils.error.isConflict(form.failure)` without inspecting status codes.
7784
+ * A successful submit refreshes no other page data. Call the `invalidate()` of the
7785
+ * data that the workflow changed in `onSuccess`, or `Sdk.hooks.useInvalidateAll()`
7786
+ * when the page cannot name it.
7784
7787
  * Success callbacks receive the parsed workflow body directly. Synchronous
7785
7788
  * output can be a scalar, list, record, or object; asynchronous workflows return
7786
7789
  * `{ execution_id }`. Narrow the value before reading authored output fields.
@@ -7866,6 +7869,12 @@ export type SdkHooks = {
7866
7869
  * `reset()` also starts a fresh key lifecycle. The hook does not poll asynchronous
7867
7870
  * executions.
7868
7871
  *
7872
+ * A successful run refreshes no other page data. When the workflow changes data that
7873
+ * the page shows, call that data's `invalidate()` in `onSuccess`. Use
7874
+ * `Sdk.hooks.useInvalidateAll()` only when the page cannot name what changed. A
7875
+ * workflow that only reads, such as a search called inside a `Sdk.hooks.useApi`
7876
+ * fetcher, needs no `onSuccess`.
7877
+ *
7869
7878
  * @example
7870
7879
  * ```tsx
7871
7880
  * function ReserveButton({ slotId }) {
@@ -14239,7 +14248,9 @@ export type WorkflowFormProps = {
14239
14248
  * suppress. */
14240
14249
  successMessage?: string | null;
14241
14250
 
14242
- /** Called after a successful submission with the workflow's response payload. */
14251
+ /** Called after a successful submission with the workflow's response payload. A
14252
+ * submission refreshes no other page data, so call the `invalidate()` of the data
14253
+ * that the workflow changed here. */
14243
14254
  onSuccess?: (response: SdkWorkflowResponse) => void;
14244
14255
 
14245
14256
  /** Called when the submission resolves with a non-2xx response, with
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diagonal-hq/pages",
3
- "version": "0.3.5",
3
+ "version": "0.4.0",
4
4
  "description": "The Page SDK for the pages of file-based Diagonal workspaces.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {