@diagonal-hq/pages 0.3.4 → 0.3.5

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/dist/index.d.ts CHANGED
@@ -7869,9 +7869,11 @@ export type SdkHooks = {
7869
7869
  * @example
7870
7870
  * ```tsx
7871
7871
  * function ReserveButton({ slotId }) {
7872
+ * const slots = Sdk.hooks.useApi(['slots'], (api) => api.get('/api/slots'));
7872
7873
  * const action = Sdk.hooks.useWorkflowAction({
7873
7874
  * workflowId: 'reserve-slot',
7874
- * idempotent: true
7875
+ * idempotent: true,
7876
+ * onSuccess: () => slots.invalidate()
7875
7877
  * });
7876
7878
  *
7877
7879
  * return (
@@ -7901,8 +7903,28 @@ export type SdkHooks = {
7901
7903
  params?: Record<string, any>;
7902
7904
  /** Generate and manage the conventional `idempotency_key` input. */
7903
7905
  idempotent?: boolean;
7906
+ /** Called with the parsed response after every successful run, including a run
7907
+ * that a later run replaced. Refresh the data that the workflow changed here. */
7908
+ onSuccess?: (response: SdkWorkflowResponse) => void;
7904
7909
  }): UseWorkflowActionResult;
7905
7910
 
7911
+ /**
7912
+ * Returns a function that refreshes every data query on the page. Use it after a
7913
+ * write when the page cannot name the data that the write changed. Prefer the
7914
+ * `invalidate()` of each affected data hook, because a full refresh refetches
7915
+ * every query on the page.
7916
+ *
7917
+ * @example
7918
+ * ```tsx
7919
+ * const invalidateAll = Sdk.hooks.useInvalidateAll();
7920
+ * const importMembers = Sdk.hooks.useWorkflowAction({
7921
+ * workflowId: 'import-members',
7922
+ * onSuccess: () => invalidateAll()
7923
+ * });
7924
+ * ```
7925
+ */
7926
+ useInvalidateAll(): () => Promise<void>;
7927
+
7906
7928
  /**
7907
7929
  * Reactive timelines of a record's schedule workflow runs, the data behind
7908
7930
  * `Sdk.Components.RecordScheduleDisplay`, for pages that render a custom
@@ -14526,6 +14548,7 @@ export declare const useForm: SdkInternal.FilePageSdk["useForm"];
14526
14548
  export declare const useHoldScheduledNotification: SdkInternal.FilePageSdk["hooks"]["useHoldScheduledNotification"];
14527
14549
  export declare const useInfiniteRecords: SdkInternal.FilePageSdk["hooks"]["useInfiniteRecords"];
14528
14550
  export declare const useInput: SdkInternal.FilePageSdk["helpers"]["useInput"];
14551
+ export declare const useInvalidateAll: SdkInternal.FilePageSdk["hooks"]["useInvalidateAll"];
14529
14552
  export declare const useLocalStorage: SdkInternal.FilePageSdk["hooks"]["useLocalStorage"];
14530
14553
  export declare const useMenu: SdkInternal.FilePageSdk["useMenu"];
14531
14554
  export declare const useNewCalendarEvent: SdkInternal.FilePageSdk["hooks"]["useNewCalendarEvent"];
package/dist/index.js CHANGED
@@ -180,6 +180,7 @@ export const useForm = undefined;
180
180
  export const useHoldScheduledNotification = undefined;
181
181
  export const useInfiniteRecords = undefined;
182
182
  export const useInput = undefined;
183
+ export const useInvalidateAll = undefined;
183
184
  export const useLocalStorage = undefined;
184
185
  export const useMenu = undefined;
185
186
  export const useNewCalendarEvent = undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diagonal-hq/pages",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "The Page SDK for the pages of file-based Diagonal workspaces.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {