@isograph/react 0.0.0-main-67785c60 → 0.0.0-main-94c46ec4

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
@@ -16,5 +16,6 @@ export { useReadAndSubscribe, useSubscribeToMultiple, } from './react/useReadAnd
16
16
  export { useLazyReference } from './react/useLazyReference';
17
17
  export { useRerenderOnChange } from './react/useRerenderOnChange';
18
18
  export { useClientSideDefer } from './loadable-hooks/useClientSideDefer';
19
+ export { useImperativeExposedMutationField } from './loadable-hooks/useImperativeExposedMutationField';
19
20
  export { useSkipLimitPagination } from './loadable-hooks/useSkipLimitPagination';
20
21
  export { useImperativeLoadableField } from './loadable-hooks/useImperativeLoadableField';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useImperativeLoadableField = exports.useSkipLimitPagination = exports.useClientSideDefer = exports.useRerenderOnChange = exports.useLazyReference = exports.useSubscribeToMultiple = exports.useReadAndSubscribe = exports.useResult = exports.FragmentReader = exports.useImperativeReference = exports.useIsographEnvironment = exports.IsographEnvironmentProvider = exports.stableIdForFragmentReference = exports.readButDoNotEvaluate = exports.assertIsEntrypoint = exports.defaultMissingFieldHandler = exports.createIsographStore = exports.createIsographEnvironment = exports.ROOT_ID = exports.makeNetworkRequest = exports.normalizeData = exports.subscribe = exports.wrapPromise = exports.wrapResolvedValue = exports.getPromiseState = exports.readPromise = exports.garbageCollectEnvironment = exports.unretainQuery = exports.retainQuery = void 0;
3
+ exports.useImperativeLoadableField = exports.useSkipLimitPagination = exports.useImperativeExposedMutationField = exports.useClientSideDefer = exports.useRerenderOnChange = exports.useLazyReference = exports.useSubscribeToMultiple = exports.useReadAndSubscribe = exports.useResult = exports.FragmentReader = exports.useImperativeReference = exports.useIsographEnvironment = exports.IsographEnvironmentProvider = exports.stableIdForFragmentReference = exports.readButDoNotEvaluate = exports.assertIsEntrypoint = exports.defaultMissingFieldHandler = exports.createIsographStore = exports.createIsographEnvironment = exports.ROOT_ID = exports.makeNetworkRequest = exports.normalizeData = exports.subscribe = exports.wrapPromise = exports.wrapResolvedValue = exports.getPromiseState = exports.readPromise = exports.garbageCollectEnvironment = exports.unretainQuery = exports.retainQuery = void 0;
4
4
  var garbageCollection_1 = require("./core/garbageCollection");
5
5
  Object.defineProperty(exports, "retainQuery", { enumerable: true, get: function () { return garbageCollection_1.retainQuery; } });
6
6
  Object.defineProperty(exports, "unretainQuery", { enumerable: true, get: function () { return garbageCollection_1.unretainQuery; } });
@@ -44,6 +44,8 @@ var useRerenderOnChange_1 = require("./react/useRerenderOnChange");
44
44
  Object.defineProperty(exports, "useRerenderOnChange", { enumerable: true, get: function () { return useRerenderOnChange_1.useRerenderOnChange; } });
45
45
  var useClientSideDefer_1 = require("./loadable-hooks/useClientSideDefer");
46
46
  Object.defineProperty(exports, "useClientSideDefer", { enumerable: true, get: function () { return useClientSideDefer_1.useClientSideDefer; } });
47
+ var useImperativeExposedMutationField_1 = require("./loadable-hooks/useImperativeExposedMutationField");
48
+ Object.defineProperty(exports, "useImperativeExposedMutationField", { enumerable: true, get: function () { return useImperativeExposedMutationField_1.useImperativeExposedMutationField; } });
47
49
  var useSkipLimitPagination_1 = require("./loadable-hooks/useSkipLimitPagination");
48
50
  Object.defineProperty(exports, "useSkipLimitPagination", { enumerable: true, get: function () { return useSkipLimitPagination_1.useSkipLimitPagination; } });
49
51
  var useImperativeLoadableField_1 = require("./loadable-hooks/useImperativeLoadableField");
@@ -0,0 +1,5 @@
1
+ type UseImperativeLoadableFieldReturn<TArgs> = {
2
+ loadField: (args: TArgs) => void;
3
+ };
4
+ export declare function useImperativeExposedMutationField<TArgs>(exposedField: (args: TArgs) => [string, () => void]): UseImperativeLoadableFieldReturn<TArgs>;
5
+ export {};
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useImperativeExposedMutationField = void 0;
4
+ // Note: this function doesn't seem to work if there are additional arguments,
5
+ // e.g. with set_pet_tagline. Why? This seems to straightforwardly call
6
+ // exposedField(args)[1](); Odd.
7
+ function useImperativeExposedMutationField(exposedField) {
8
+ return {
9
+ loadField: (args) => {
10
+ const [_id, loader] = exposedField(args);
11
+ loader();
12
+ },
13
+ };
14
+ }
15
+ exports.useImperativeExposedMutationField = useImperativeExposedMutationField;
@@ -22,7 +22,9 @@ type UseSkipLimitReturnValue<TArgs, TItem> = {
22
22
  *
23
23
  * Calling fetchMore before the hook mounts is a no-op.
24
24
  *
25
- * TODO subscribe to changes
25
+ * NOTE: this hook does not subscribe to changes. This is a known
26
+ * issue. If you are running into this issue, reach out on GitHub/
27
+ * Twitter, and we'll fix the issue.
26
28
  */
27
29
  export declare function useSkipLimitPagination<TArgs extends {
28
30
  skip: number | void | null;
@@ -27,7 +27,9 @@ function flatten(arr) {
27
27
  *
28
28
  * Calling fetchMore before the hook mounts is a no-op.
29
29
  *
30
- * TODO subscribe to changes
30
+ * NOTE: this hook does not subscribe to changes. This is a known
31
+ * issue. If you are running into this issue, reach out on GitHub/
32
+ * Twitter, and we'll fix the issue.
31
33
  */
32
34
  function useSkipLimitPagination(loadableField) {
33
35
  const networkRequestOptions = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isograph/react",
3
- "version": "0.0.0-main-67785c60",
3
+ "version": "0.0.0-main-94c46ec4",
4
4
  "description": "Use Isograph with React",
5
5
  "homepage": "https://isograph.dev",
6
6
  "main": "dist/index.js",
@@ -17,9 +17,9 @@
17
17
  "tsc": "tsc"
18
18
  },
19
19
  "dependencies": {
20
- "@isograph/disposable-types": "0.0.0-main-67785c60",
21
- "@isograph/react-disposable-state": "0.0.0-main-67785c60",
22
- "@isograph/reference-counted-pointer": "0.0.0-main-67785c60"
20
+ "@isograph/disposable-types": "0.0.0-main-94c46ec4",
21
+ "@isograph/react-disposable-state": "0.0.0-main-94c46ec4",
22
+ "@isograph/reference-counted-pointer": "0.0.0-main-94c46ec4"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "react": "18.2.0"
package/src/index.ts CHANGED
@@ -81,5 +81,6 @@ export { useLazyReference } from './react/useLazyReference';
81
81
  export { useRerenderOnChange } from './react/useRerenderOnChange';
82
82
 
83
83
  export { useClientSideDefer } from './loadable-hooks/useClientSideDefer';
84
+ export { useImperativeExposedMutationField } from './loadable-hooks/useImperativeExposedMutationField';
84
85
  export { useSkipLimitPagination } from './loadable-hooks/useSkipLimitPagination';
85
86
  export { useImperativeLoadableField } from './loadable-hooks/useImperativeLoadableField';
@@ -0,0 +1,17 @@
1
+ type UseImperativeLoadableFieldReturn<TArgs> = {
2
+ loadField: (args: TArgs) => void;
3
+ };
4
+
5
+ // Note: this function doesn't seem to work if there are additional arguments,
6
+ // e.g. with set_pet_tagline. Why? This seems to straightforwardly call
7
+ // exposedField(args)[1](); Odd.
8
+ export function useImperativeExposedMutationField<TArgs>(
9
+ exposedField: (args: TArgs) => [string, () => void],
10
+ ): UseImperativeLoadableFieldReturn<TArgs> {
11
+ return {
12
+ loadField: (args: TArgs) => {
13
+ const [_id, loader] = exposedField(args);
14
+ loader();
15
+ },
16
+ };
17
+ }
@@ -61,7 +61,9 @@ function flatten<T>(arr: ReadonlyArray<ReadonlyArray<T>>): ReadonlyArray<T> {
61
61
  *
62
62
  * Calling fetchMore before the hook mounts is a no-op.
63
63
  *
64
- * TODO subscribe to changes
64
+ * NOTE: this hook does not subscribe to changes. This is a known
65
+ * issue. If you are running into this issue, reach out on GitHub/
66
+ * Twitter, and we'll fix the issue.
65
67
  */
66
68
  export function useSkipLimitPagination<
67
69
  TArgs extends {