@devvit/public-api 0.10.22-next-2024-06-06-cf36c56e2.0 → 0.10.22-next-2024-06-06-0f86ae113.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"BlocksHandler.d.ts","sourceRoot":"","sources":["../../../../../src/devvit/internals/blocks/handler/BlocksHandler.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAO7F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAe,IAAI,EAAE,UAAU,EAAE,WAAW,EAAS,MAAM,YAAY,CAAC;AAIpF;;;;;;GAMG;AACH,eAAO,IAAI,oBAAoB,EAAE,aAAa,GAAG,IAAW,CAAC;AAE7D,wBAAgB,gBAAgB,IAAI,aAAa,CAKhD;AAED,wBAAgB,WAAW,IAAI,OAAO,CAErC;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,IAAI,EACzC,OAAO,EAAE,WAAW,EACpB,WAAW,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,CAAC,GAChC,CAAC,CA8BH;AAED,eAAO,IAAI,oBAAoB,EAAE,aAAa,GAAG,IAAW,CAAC;AAE7D;;;;GAIG;AACH,qBAAa,aAAa;;IAIxB,oBAAoB,EAAE,aAAa,GAAG,IAAI,CAAQ;gBAEtC,IAAI,EAAE,GAAG,CAAC,iBAAiB;IAMjC,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;CAgV1E"}
1
+ {"version":3,"file":"BlocksHandler.d.ts","sourceRoot":"","sources":["../../../../../src/devvit/internals/blocks/handler/BlocksHandler.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAO7F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAe,IAAI,EAAE,UAAU,EAAE,WAAW,EAAS,MAAM,YAAY,CAAC;AAIpF;;;;;;GAMG;AACH,eAAO,IAAI,oBAAoB,EAAE,aAAa,GAAG,IAAW,CAAC;AAE7D,wBAAgB,gBAAgB,IAAI,aAAa,CAKhD;AAED,wBAAgB,WAAW,IAAI,OAAO,CAErC;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,IAAI,EACzC,OAAO,EAAE,WAAW,EACpB,WAAW,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,CAAC,GAChC,CAAC,CA8BH;AAED,eAAO,IAAI,oBAAoB,EAAE,aAAa,GAAG,IAAW,CAAC;AAE7D;;;;GAIG;AACH,qBAAa,aAAa;;IAIxB,oBAAoB,EAAE,aAAa,GAAG,IAAI,CAAQ;gBAEtC,IAAI,EAAE,GAAG,CAAC,iBAAiB;IAMjC,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;CAsV1E"}
@@ -114,7 +114,9 @@ export class BlocksHandler {
114
114
  let changed;
115
115
  let progress;
116
116
  let remaining = [...eventsToProcess];
117
+ console.debug('starting processing events');
117
118
  while (eventsToProcess.length > 0) {
119
+ console.debug('processing events loop iteration', eventsToProcess.length);
118
120
  /**
119
121
  * A concurrently executable batch is a set of events that can be executed in parallel. This either one main queue event,
120
122
  * or any number of other queue events.
@@ -168,7 +170,7 @@ export class BlocksHandler {
168
170
  for (const event of context._requeueEvents) {
169
171
  if (!isMainQueue && !event.async) {
170
172
  console.debug('NOT reprocessing event in BlocksHandler, sync mismatch A', event);
171
- // We're async, this is a main queue event. We need to send it back to the platform to let
173
+ // We're async, this is a main qrueue event. We need to send it back to the platform to let
172
174
  // the platform synchronize it.
173
175
  remainingRequeueEvents.push(event);
174
176
  continue;
@@ -232,6 +234,7 @@ export class BlocksHandler {
232
234
  }
233
235
  _BlocksHandler_root = new WeakMap(), _BlocksHandler_contextBuilder = new WeakMap(), _BlocksHandler_blocksTransformer = new WeakMap(), _BlocksHandler_instances = new WeakSet(), _BlocksHandler_loadHooks = function _BlocksHandler_loadHooks(context, ..._events) {
234
236
  // TBD: partial rendering
237
+ context._hooks = {};
235
238
  __classPrivateFieldGet(this, _BlocksHandler_instances, "m", _BlocksHandler_renderRoot).call(this, __classPrivateFieldGet(this, _BlocksHandler_root, "f"), context.request.props ?? {}, context);
236
239
  }, _BlocksHandler_handleAsyncQueues =
237
240
  /**
@@ -262,8 +265,11 @@ async function _BlocksHandler_handleAsyncQueues(context, ...batch) {
262
265
  }, _BlocksHandler_handleMainQueue = async function _BlocksHandler_handleMainQueue(context, ...batch) {
263
266
  // We need to handle events in order, so that the state is updated in the correct order.
264
267
  for (const event of batch) {
268
+ console.log('handling main queue event', event);
269
+ console.log('before', context._state);
265
270
  __classPrivateFieldGet(this, _BlocksHandler_instances, "m", _BlocksHandler_loadHooks).call(this, context, event);
266
271
  await __classPrivateFieldGet(this, _BlocksHandler_instances, "m", _BlocksHandler_attemptHook).call(this, context, event);
272
+ console.log('after', context._state);
267
273
  }
268
274
  // TODO: Decide whether this is excessive. It doesn't hurt anything besides performance.
269
275
  __classPrivateFieldGet(this, _BlocksHandler_instances, "m", _BlocksHandler_loadHooks).call(this, context);
@@ -1,10 +1,20 @@
1
1
  import type { JSONValue } from '@devvit/shared-types/json.js';
2
2
  import type { AsyncUseStateInitializer, UseAsyncResult } from '../../../../types/hooks.js';
3
+ export type AsyncOptions = {
4
+ /**
5
+ * The data loader will re-run if the value of `depends` changes.
6
+ */
7
+ depends?: JSONValue;
8
+ /**
9
+ * If `enabled` is false, the data loader will not run.
10
+ */
11
+ enabled?: boolean;
12
+ };
3
13
  /**
4
14
  * This is the preferred way to handle async state in Devvit.
5
15
  *
6
16
  * @param initializer -- any async function that returns a JSONValue
7
17
  * @returns UseAsyncResult<S>
8
18
  */
9
- export declare function useAsync<S extends JSONValue>(initializer: AsyncUseStateInitializer<S>): UseAsyncResult<S>;
19
+ export declare function useAsync<S extends JSONValue>(initializer: AsyncUseStateInitializer<S>, options?: AsyncOptions): UseAsyncResult<S>;
10
20
  //# sourceMappingURL=useAsync.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useAsync.d.ts","sourceRoot":"","sources":["../../../../../src/devvit/internals/blocks/handler/useAsync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAmF3F;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,SAAS,EAC1C,WAAW,EAAE,wBAAwB,CAAC,CAAC,CAAC,GACvC,cAAc,CAAC,CAAC,CAAC,CAMnB"}
1
+ {"version":3,"file":"useAsync.d.ts","sourceRoot":"","sources":["../../../../../src/devvit/internals/blocks/handler/useAsync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAQ3F,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAsGF;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,SAAS,EAC1C,WAAW,EAAE,wBAAwB,CAAC,CAAC,CAAC,EACxC,OAAO,GAAE,YAAiB,GACzB,cAAc,CAAC,CAAC,CAAC,CAMnB"}
@@ -9,33 +9,49 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
9
9
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
- var _AsyncHook_hookId, _AsyncHook_initializer, _AsyncHook_invalidate, _AsyncHook_ctx;
12
+ var _AsyncHook_hookId, _AsyncHook_initializer, _AsyncHook_invalidate, _AsyncHook_ctx, _AsyncHook_options, _AsyncHook_localDepends, _AsyncHook_enabled;
13
13
  import { registerHook } from './BlocksHandler.js';
14
+ import isEqual from 'lodash.isequal';
15
+ import { CIRCUIT_BREAKER_MSG } from '@devvit/shared-types/CircuitBreaker.js';
14
16
  class AsyncHook {
15
- constructor(initializer, params) {
17
+ constructor(initializer, options, params) {
16
18
  _AsyncHook_hookId.set(this, void 0);
17
19
  _AsyncHook_initializer.set(this, void 0);
18
20
  _AsyncHook_invalidate.set(this, void 0);
19
21
  _AsyncHook_ctx.set(this, void 0);
20
- console.debug('useAsync v1');
21
- this.state = { data: null, loading: false, error: null };
22
+ _AsyncHook_options.set(this, void 0);
23
+ _AsyncHook_localDepends.set(this, void 0);
24
+ _AsyncHook_enabled.set(this, void 0);
25
+ console.debug('useAsync v1', options);
26
+ __classPrivateFieldSet(this, _AsyncHook_options, options, "f");
27
+ this.state = { data: null, loading: false, error: null, depends: null };
22
28
  __classPrivateFieldSet(this, _AsyncHook_hookId, params.hookId, "f");
23
29
  __classPrivateFieldSet(this, _AsyncHook_initializer, initializer, "f");
24
30
  __classPrivateFieldSet(this, _AsyncHook_invalidate, params.invalidate, "f");
25
31
  __classPrivateFieldSet(this, _AsyncHook_ctx, params.context, "f");
32
+ __classPrivateFieldSet(this, _AsyncHook_localDepends, options.depends ?? null, "f");
33
+ __classPrivateFieldSet(this, _AsyncHook_enabled, options.enabled ?? true, "f");
26
34
  }
27
35
  /**
28
36
  * After we look at our state, we need to decide if we need to dispatch a request to load the data.
29
37
  */
30
38
  onStateLoaded() {
39
+ if (!__classPrivateFieldGet(this, _AsyncHook_enabled, "f")) {
40
+ return;
41
+ }
31
42
  console.debug('async onLoad ', __classPrivateFieldGet(this, _AsyncHook_hookId, "f"), this.state);
32
- if (this.state.data === null && this.state.error === null && this.state.loading === false) {
43
+ console.debug('async onLoad have ', __classPrivateFieldGet(this, _AsyncHook_localDepends, "f"), 'and', this.state.depends);
44
+ if (!isEqual(__classPrivateFieldGet(this, _AsyncHook_localDepends, "f"), this.state.depends) ||
45
+ (this.state.data === null && this.state.error === null && this.state.loading === false)) {
33
46
  this.state.loading = true;
47
+ this.state.depends = __classPrivateFieldGet(this, _AsyncHook_localDepends, "f");
34
48
  __classPrivateFieldGet(this, _AsyncHook_invalidate, "f").call(this);
35
49
  const requeueEvent = {
36
50
  hook: __classPrivateFieldGet(this, _AsyncHook_hookId, "f"),
37
51
  async: true,
38
- asyncRequest: { requestId: __classPrivateFieldGet(this, _AsyncHook_hookId, "f") },
52
+ asyncRequest: {
53
+ requestId: __classPrivateFieldGet(this, _AsyncHook_hookId, "f") + '-' + JSON.stringify(this.state.depends),
54
+ },
39
55
  };
40
56
  console.debug('onLoad requeue');
41
57
  __classPrivateFieldGet(this, _AsyncHook_ctx, "f").addToRequeueEvents(requeueEvent);
@@ -57,6 +73,9 @@ class AsyncHook {
57
73
  }
58
74
  catch (e) {
59
75
  if (e instanceof Error) {
76
+ if (e.message === CIRCUIT_BREAKER_MSG) {
77
+ throw e;
78
+ }
60
79
  asyncResponse.error = { message: e.message, details: e.stack ?? '' };
61
80
  }
62
81
  else {
@@ -71,29 +90,35 @@ class AsyncHook {
71
90
  context.addToRequeueEvents(requeueEvent);
72
91
  }
73
92
  else if (event.asyncResponse) {
74
- const result = {
75
- data: event.asyncResponse.data?.value,
76
- loading: false,
77
- error: event.asyncResponse.error ?? null,
78
- };
79
- this.state = result;
80
- __classPrivateFieldGet(this, _AsyncHook_invalidate, "f").call(this);
93
+ const anticipatedRequestId = __classPrivateFieldGet(this, _AsyncHook_hookId, "f") + '-' + JSON.stringify(this.state.depends);
94
+ if (event.asyncResponse.requestId === anticipatedRequestId) {
95
+ const result = {
96
+ data: event.asyncResponse.data?.value,
97
+ loading: false,
98
+ error: event.asyncResponse.error ?? null,
99
+ };
100
+ this.state = { ...this.state, ...result };
101
+ __classPrivateFieldGet(this, _AsyncHook_invalidate, "f").call(this);
102
+ }
103
+ else {
104
+ console.debug('onResp skip, stale event');
105
+ }
81
106
  }
82
107
  else {
83
108
  throw new Error('Unknown event type');
84
109
  }
85
110
  }
86
111
  }
87
- _AsyncHook_hookId = new WeakMap(), _AsyncHook_initializer = new WeakMap(), _AsyncHook_invalidate = new WeakMap(), _AsyncHook_ctx = new WeakMap();
112
+ _AsyncHook_hookId = new WeakMap(), _AsyncHook_initializer = new WeakMap(), _AsyncHook_invalidate = new WeakMap(), _AsyncHook_ctx = new WeakMap(), _AsyncHook_options = new WeakMap(), _AsyncHook_localDepends = new WeakMap(), _AsyncHook_enabled = new WeakMap();
88
113
  /**
89
114
  * This is the preferred way to handle async state in Devvit.
90
115
  *
91
116
  * @param initializer -- any async function that returns a JSONValue
92
117
  * @returns UseAsyncResult<S>
93
118
  */
94
- export function useAsync(initializer) {
119
+ export function useAsync(initializer, options = {}) {
95
120
  const hook = registerHook({ namespace: 'useAsync' }, (params) => {
96
- return new AsyncHook(initializer, params);
121
+ return new AsyncHook(initializer, options, params);
97
122
  });
98
123
  return hook.state;
99
124
  }
package/meta.json CHANGED
@@ -12491,14 +12491,29 @@
12491
12491
  ],
12492
12492
  "format": "esm"
12493
12493
  },
12494
+ "../shared-types/dist/CircuitBreaker.js": {
12495
+ "bytes": 943,
12496
+ "imports": [],
12497
+ "format": "esm"
12498
+ },
12494
12499
  "src/devvit/internals/blocks/handler/useAsync.ts": {
12495
- "bytes": 3350,
12500
+ "bytes": 4653,
12496
12501
  "imports": [
12497
12502
  {
12498
12503
  "path": "src/devvit/internals/blocks/handler/BlocksHandler.ts",
12499
12504
  "kind": "import-statement",
12500
12505
  "original": "./BlocksHandler.js"
12501
12506
  },
12507
+ {
12508
+ "path": "../../node_modules/lodash.isequal/index.js",
12509
+ "kind": "import-statement",
12510
+ "original": "lodash.isequal"
12511
+ },
12512
+ {
12513
+ "path": "../shared-types/dist/CircuitBreaker.js",
12514
+ "kind": "import-statement",
12515
+ "original": "@devvit/shared-types/CircuitBreaker.js"
12516
+ },
12502
12517
  {
12503
12518
  "path": "<runtime>",
12504
12519
  "kind": "import-statement",
@@ -12508,7 +12523,7 @@
12508
12523
  "format": "esm"
12509
12524
  },
12510
12525
  "src/devvit/internals/blocks/handler/BlocksHandler.ts": {
12511
- "bytes": 15852,
12526
+ "bytes": 16152,
12512
12527
  "imports": [
12513
12528
  {
12514
12529
  "path": "@devvit/protos",
@@ -14411,7 +14426,7 @@
14411
14426
  "bytesInOutput": 3085
14412
14427
  },
14413
14428
  "src/devvit/internals/blocks/handler/BlocksHandler.ts": {
14414
- "bytesInOutput": 13219
14429
+ "bytesInOutput": 13522
14415
14430
  },
14416
14431
  "src/devvit/internals/blocks/handler/useForm.ts": {
14417
14432
  "bytesInOutput": 915
@@ -14438,7 +14453,10 @@
14438
14453
  "bytesInOutput": 1558
14439
14454
  },
14440
14455
  "src/devvit/internals/blocks/handler/useAsync.ts": {
14441
- "bytesInOutput": 2744
14456
+ "bytesInOutput": 4060
14457
+ },
14458
+ "../shared-types/dist/CircuitBreaker.js": {
14459
+ "bytesInOutput": 50
14442
14460
  },
14443
14461
  "src/devvit/internals/ui-request-handler.ts": {
14444
14462
  "bytesInOutput": 618
@@ -14522,7 +14540,7 @@
14522
14540
  "bytesInOutput": 370
14523
14541
  }
14524
14542
  },
14525
- "bytes": 14954664
14543
+ "bytes": 14961084
14526
14544
  }
14527
14545
  }
14528
14546
  }
package/meta.min.json CHANGED
@@ -3721,14 +3721,29 @@
3721
3721
  ],
3722
3722
  "format": "esm"
3723
3723
  },
3724
+ "../shared-types/dist/CircuitBreaker.js": {
3725
+ "bytes": 943,
3726
+ "imports": [],
3727
+ "format": "esm"
3728
+ },
3724
3729
  "src/devvit/internals/blocks/handler/useAsync.ts": {
3725
- "bytes": 3350,
3730
+ "bytes": 4653,
3726
3731
  "imports": [
3727
3732
  {
3728
3733
  "path": "src/devvit/internals/blocks/handler/BlocksHandler.ts",
3729
3734
  "kind": "import-statement",
3730
3735
  "original": "./BlocksHandler.js"
3731
3736
  },
3737
+ {
3738
+ "path": "../../node_modules/lodash.isequal/index.js",
3739
+ "kind": "import-statement",
3740
+ "original": "lodash.isequal"
3741
+ },
3742
+ {
3743
+ "path": "../shared-types/dist/CircuitBreaker.js",
3744
+ "kind": "import-statement",
3745
+ "original": "@devvit/shared-types/CircuitBreaker.js"
3746
+ },
3732
3747
  {
3733
3748
  "path": "<runtime>",
3734
3749
  "kind": "import-statement",
@@ -3738,7 +3753,7 @@
3738
3753
  "format": "esm"
3739
3754
  },
3740
3755
  "src/devvit/internals/blocks/handler/BlocksHandler.ts": {
3741
- "bytes": 15852,
3756
+ "bytes": 16152,
3742
3757
  "imports": [
3743
3758
  {
3744
3759
  "path": "@devvit/protos",
@@ -4643,7 +4658,7 @@
4643
4658
  "imports": [],
4644
4659
  "exports": [],
4645
4660
  "inputs": {},
4646
- "bytes": 1129986
4661
+ "bytes": 1133674
4647
4662
  },
4648
4663
  "dist/public-api.min.js": {
4649
4664
  "imports": [
@@ -5320,7 +5335,7 @@
5320
5335
  "bytesInOutput": 260
5321
5336
  },
5322
5337
  "src/devvit/internals/blocks/handler/BlocksHandler.ts": {
5323
- "bytesInOutput": 5523
5338
+ "bytesInOutput": 5741
5324
5339
  },
5325
5340
  "src/devvit/internals/blocks/handler/UIClient.ts": {
5326
5341
  "bytesInOutput": 974
@@ -5347,7 +5362,10 @@
5347
5362
  "bytesInOutput": 627
5348
5363
  },
5349
5364
  "src/devvit/internals/blocks/handler/useAsync.ts": {
5350
- "bytesInOutput": 1265
5365
+ "bytesInOutput": 1874
5366
+ },
5367
+ "../shared-types/dist/CircuitBreaker.js": {
5368
+ "bytesInOutput": 28
5351
5369
  },
5352
5370
  "src/apis/reddit/helpers/makeGettersEnumerable.ts": {
5353
5371
  "bytesInOutput": 166
@@ -5425,7 +5443,7 @@
5425
5443
  "bytesInOutput": 178
5426
5444
  }
5427
5445
  },
5428
- "bytes": 239753
5446
+ "bytes": 240608
5429
5447
  }
5430
5448
  }
5431
5449
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devvit/public-api",
3
- "version": "0.10.22-next-2024-06-06-cf36c56e2.0",
3
+ "version": "0.10.22-next-2024-06-06-0f86ae113.0",
4
4
  "license": "BSD-3-Clause",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,8 +30,8 @@
30
30
  },
31
31
  "types": "./index.d.ts",
32
32
  "dependencies": {
33
- "@devvit/protos": "0.10.22-next-2024-06-06-cf36c56e2.0",
34
- "@devvit/shared-types": "0.10.22-next-2024-06-06-cf36c56e2.0",
33
+ "@devvit/protos": "0.10.22-next-2024-06-06-0f86ae113.0",
34
+ "@devvit/shared-types": "0.10.22-next-2024-06-06-0f86ae113.0",
35
35
  "base64-js": "1.5.1",
36
36
  "clone-deep": "4.0.1",
37
37
  "core-js": "3.27.2",
@@ -41,7 +41,7 @@
41
41
  "@ampproject/filesize": "4.3.0",
42
42
  "@devvit/eslint-config": "0.10.21",
43
43
  "@devvit/repo-tools": "0.10.21",
44
- "@devvit/tsconfig": "0.10.22-next-2024-06-06-cf36c56e2.0",
44
+ "@devvit/tsconfig": "0.10.22-next-2024-06-06-0f86ae113.0",
45
45
  "@microsoft/api-extractor": "7.41.0",
46
46
  "@reddit/faceplate-ui": "11.3.3",
47
47
  "@types/clone-deep": "4.0.1",
@@ -64,5 +64,5 @@
64
64
  }
65
65
  },
66
66
  "source": "./src/index.ts",
67
- "gitHead": "1ebbed96dc0b4e6c74e670fa46ad4d11db531c03"
67
+ "gitHead": "2d281619c3a9a358cb8851ff2f58ee52fb0bbf6b"
68
68
  }
package/public-api.d.ts CHANGED
@@ -1457,6 +1457,17 @@ declare const AsyncError_2: {
1457
1457
  fromPartial(object: DeepPartial_49<AsyncError_2>): AsyncError_2;
1458
1458
  };
1459
1459
 
1460
+ declare type AsyncOptions = {
1461
+ /**
1462
+ * The data loader will re-run if the value of `depends` changes.
1463
+ */
1464
+ depends?: JSONValue;
1465
+ /**
1466
+ * If `enabled` is false, the data loader will not run.
1467
+ */
1468
+ enabled?: boolean;
1469
+ };
1470
+
1460
1471
  declare interface AsyncRequest {
1461
1472
  requestId: string;
1462
1473
  data?: {
@@ -65410,7 +65421,7 @@ declare type UrlString = string;
65410
65421
  * @param initializer -- any async function that returns a JSONValue
65411
65422
  * @returns UseAsyncResult<S>
65412
65423
  */
65413
- export declare function useAsync<S extends JSONValue>(initializer: AsyncUseStateInitializer<S>): UseAsyncResult<S>;
65424
+ export declare function useAsync<S extends JSONValue>(initializer: AsyncUseStateInitializer<S>, options?: AsyncOptions): UseAsyncResult<S>;
65414
65425
 
65415
65426
  export declare type UseAsyncResult<S> = {
65416
65427
  data: S | null;