@royaltics/ui 1.9.5 → 1.9.6
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHttpState.d.ts","sourceRoot":"","sources":["../../src/hooks/useHttpState.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAW7E,QAAA,MAAM,YAAY,GAAI,WAAW;IAAE,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE;;;
|
|
1
|
+
{"version":3,"file":"useHttpState.d.ts","sourceRoot":"","sources":["../../src/hooks/useHttpState.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAW7E,QAAA,MAAM,YAAY,GAAI,WAAW;IAAE,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE;;;iBAgBnD,OAAO;oBAAc,OAAO;;wBAoBzC,QAAQ,OAAO,MAAM,GAAG,MAAM,EAAE,QAAQ,qBAAqB,CAAC,GAAG,CAAC;8BAH5D,QAAQ;;UAN5B,CAAC,aAAa,MAAM,GAAG,MAAM,EAAE,QAAQ,qBAAqB,CAAC,CAAC,CAAC;kBAGvD,CAAC,eAAe,MAAM,GAAG,MAAM,EAAE,QAAQ,qBAAqB,CAAC,CAAC,CAAC;WASxE,CAAC,aAAa,MAAM,GAAG,MAAM,EAAE,QAAQ,qBAAqB,CAAC,CAAC,CAAC;YAG9D,CAAC,aAAa,MAAM,GAAG,MAAM,EAAE,QAAQ,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC;gBAG3E,CAAC,aAAa,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,QAAQ,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC;UAGlH,CAAC,aAAa,MAAM,GAAG,MAAM,EAAE,QAAQ,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC;WAG9E,CAAC,aAAa,MAAM,GAAG,MAAM,EAAE,QAAQ,qBAAqB,CAAC,CAAC,CAAC;iBAGzD,CAAC,aAAa,MAAM,GAAG,MAAM,EAAE,QAAQ,qBAAqB,CAAC,CAAC,CAAC;CAkB/F,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -3,48 +3,34 @@ import { useHttpSubscriptions } from "../core/http/useHttpsubscriptions.js";
|
|
|
3
3
|
import { executeGet, executeGetInfinite, executeMutation, fetchNextPageAction, refetchAction, fileAction, fileChunksAction } from "../core/http/http-actions.js";
|
|
4
4
|
const useHttpState = (_options) => {
|
|
5
5
|
const core = useHttpSubscriptions();
|
|
6
|
-
const { setupSubscription, cleanupSubscription, setOperationLoading, generateReadableKey, queryManager, queryFunctionsRef, setQueryStates } = core;
|
|
7
|
-
const isLoading = Object.values(
|
|
6
|
+
const { setupSubscription, cleanupSubscription, setOperationLoading, generateReadableKey, queryManager, queryFunctionsRef, setQueryStates, queryStates, loadingOperationsRef } = core;
|
|
7
|
+
const isLoading = Object.values(queryStates).some((state) => state.isLoading) || loadingOperationsRef.current.size > 0;
|
|
8
8
|
const paginates = useMemo(() => {
|
|
9
|
-
return Object.keys(
|
|
9
|
+
return Object.keys(queryStates).reduce((acc, key) => {
|
|
10
10
|
acc[key] = {
|
|
11
|
-
hasNext:
|
|
12
|
-
isFetching:
|
|
11
|
+
hasNext: queryStates[key].hasNextPage,
|
|
12
|
+
isFetching: queryStates[key].isFetchingNextPage,
|
|
13
13
|
};
|
|
14
14
|
return acc;
|
|
15
15
|
}, {});
|
|
16
|
-
}, [
|
|
17
|
-
//
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}), [setupSubscription, cleanupSubscription, setOperationLoading, generateReadableKey, queryManager, queryFunctionsRef, setQueryStates]);
|
|
29
|
-
// Note: Some actions like fetchNextPageAction DO use core.queryStates.
|
|
30
|
-
// We'll keep them as is for now, as queryStates change is unavoidable for them.
|
|
31
|
-
// But get, post, etc. will now be MORE stable.
|
|
32
|
-
const get = useCallback((api, opts) => executeGet(stableCore, api, opts), [stableCore]);
|
|
33
|
-
const getInfinite = useCallback((api, opts) => executeGetInfinite(stableCore, api, opts), [stableCore]);
|
|
34
|
-
const fetchNextPage = useCallback((queryKey) => fetchNextPageAction(core, queryKey), [core.generateReadableKey, core.queryStates, core.queryFunctionsRef, core.setQueryStates]);
|
|
35
|
-
const refetch = useCallback((queryKey, api, opts) => refetchAction(core, queryKey, api, opts), [core.generateReadableKey, core.queryStates, core.setQueryStates]);
|
|
36
|
-
const post = useCallback((api, opts) => executeMutation(stableCore, api, opts, 'POST'), [stableCore]);
|
|
37
|
-
const patch = useCallback((api, opts) => executeMutation(stableCore, api, opts, 'PATCH'), [stableCore]);
|
|
38
|
-
const postPatch = useCallback((api, id, opts) => executeMutation(stableCore, id ? [api, String(id)] : api, opts, id ? 'PATCH' : 'POST'), [stableCore]);
|
|
39
|
-
const del = useCallback((api, opts) => executeMutation(stableCore, api, opts, 'DELETE'), [stableCore]);
|
|
40
|
-
const file = useCallback((api, opts) => fileAction(stableCore, api, opts), [stableCore]);
|
|
41
|
-
const fileChunks = useCallback((api, opts) => fileChunksAction(stableCore, api, opts), [stableCore]);
|
|
16
|
+
}, [queryStates]);
|
|
17
|
+
// These functions are 이제 stable because their dependencies (from core) are stable functions
|
|
18
|
+
const get = useCallback((api, opts) => executeGet(core, api, opts), [setupSubscription, setOperationLoading, queryManager]);
|
|
19
|
+
const getInfinite = useCallback((api, opts) => executeGetInfinite(core, api, opts), [setupSubscription, generateReadableKey, queryManager, queryFunctionsRef]);
|
|
20
|
+
const fetchNextPage = useCallback((queryKey) => fetchNextPageAction(core, queryKey), [generateReadableKey, queryStates, queryFunctionsRef, setQueryStates]);
|
|
21
|
+
const refetch = useCallback((queryKey, api, opts) => refetchAction(core, queryKey, api, opts), [generateReadableKey, queryStates, setQueryStates]);
|
|
22
|
+
const post = useCallback((api, opts) => executeMutation(core, api, opts, 'POST'), [setOperationLoading, queryManager]);
|
|
23
|
+
const patch = useCallback((api, opts) => executeMutation(core, api, opts, 'PATCH'), [setOperationLoading, queryManager]);
|
|
24
|
+
const postPatch = useCallback((api, id, opts) => executeMutation(core, id ? [api, String(id)] : api, opts, id ? 'PATCH' : 'POST'), [setOperationLoading, queryManager]);
|
|
25
|
+
const del = useCallback((api, opts) => executeMutation(core, api, opts, 'DELETE'), [setOperationLoading, queryManager]);
|
|
26
|
+
const file = useCallback((api, opts) => fileAction(core, api, opts), [setOperationLoading]);
|
|
27
|
+
const fileChunks = useCallback((api, opts) => fileChunksAction(core, api, opts), [setOperationLoading]);
|
|
42
28
|
return {
|
|
43
29
|
isLoading,
|
|
44
30
|
paginates,
|
|
45
31
|
refetch,
|
|
46
32
|
fetchNextPage,
|
|
47
|
-
cleanupQuery:
|
|
33
|
+
cleanupQuery: cleanupSubscription,
|
|
48
34
|
get,
|
|
49
35
|
getInfinite,
|
|
50
36
|
post,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHttpState.js","sourceRoot":"","sources":["../../src/hooks/useHttpState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAE5E,OAAO,EACN,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,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AAmB;QACjC,GAAG;QACH,WAAW;QACX,IAAI;QACJ,KAAK;QACL,SAAS;QACT,GAAG;QACH,IAAI;QACJ,UAAU;KACV,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@royaltics/ui",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -84,9 +84,9 @@
|
|
|
84
84
|
"test:coverage": "vitest --coverage"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
|
-
"react": "^
|
|
88
|
-
"react-dom": "^
|
|
89
|
-
"react-router-dom": "^
|
|
87
|
+
"react": "^19",
|
|
88
|
+
"react-dom": "^19",
|
|
89
|
+
"react-router-dom": "^7",
|
|
90
90
|
"tailwindcss": "^4"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
@@ -94,48 +94,40 @@
|
|
|
94
94
|
"@storybook/addon-docs": "9.0.16",
|
|
95
95
|
"@storybook/addon-onboarding": "9.0.16",
|
|
96
96
|
"@storybook/addon-postcss": "^2.0.0",
|
|
97
|
-
"@storybook/addon-themes": "^9.
|
|
97
|
+
"@storybook/addon-themes": "^9.1.20",
|
|
98
98
|
"@storybook/react-vite": "9.0.16",
|
|
99
99
|
"@testing-library/jest-dom": "^6.9.1",
|
|
100
|
-
"@testing-library/react": "^16.3.
|
|
100
|
+
"@testing-library/react": "^16.3.2",
|
|
101
101
|
"@testing-library/react-hooks": "^8.0.1",
|
|
102
|
-
"@types/node": "^24.0
|
|
103
|
-
"@types/react": "^18.
|
|
104
|
-
"@types/react-dom": "^18.
|
|
105
|
-
"@types/youtube": "^0.1.
|
|
106
|
-
"@vitejs/plugin-react": "^5.1.
|
|
107
|
-
"@vitest/coverage-v8": "^4.0.
|
|
108
|
-
"jsdom": "^27.0
|
|
109
|
-
"postcss": "^8.5.
|
|
110
|
-
"react": "^19.
|
|
102
|
+
"@types/node": "^24.12.0",
|
|
103
|
+
"@types/react": "^18.3.28",
|
|
104
|
+
"@types/react-dom": "^18.3.7",
|
|
105
|
+
"@types/youtube": "^0.1.2",
|
|
106
|
+
"@vitejs/plugin-react": "^5.1.4",
|
|
107
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
108
|
+
"jsdom": "^27.4.0",
|
|
109
|
+
"postcss": "^8.5.8",
|
|
110
|
+
"react": "^19.2.4",
|
|
111
111
|
"react-dom": "19.1.0",
|
|
112
|
-
"react-router-dom": "^7.
|
|
112
|
+
"react-router-dom": "^7.13.1",
|
|
113
113
|
"storybook": "9.0.16",
|
|
114
|
-
"tailwindcss": "^4.1
|
|
114
|
+
"tailwindcss": "^4.2.1",
|
|
115
115
|
"tsc-alias": "^1.8.16",
|
|
116
|
-
"tsup": "^8.5.
|
|
117
|
-
"typescript": "^5.
|
|
118
|
-
"vitest": "^4.0.
|
|
116
|
+
"tsup": "^8.5.1",
|
|
117
|
+
"typescript": "^5.9.3",
|
|
118
|
+
"vitest": "^4.0.18"
|
|
119
119
|
},
|
|
120
120
|
"dependencies": {
|
|
121
121
|
"@heroicons/react": "^2.2.0",
|
|
122
|
-
"@tailwindcss/postcss": "^4.1
|
|
122
|
+
"@tailwindcss/postcss": "^4.2.1",
|
|
123
123
|
"classnames": "^2.5.1",
|
|
124
124
|
"clsx": "^2.1.1",
|
|
125
|
-
"memoize": "^10.
|
|
125
|
+
"memoize": "^10.2.0",
|
|
126
126
|
"memoize-one": "^6.0.0",
|
|
127
|
-
"query-string": "^9.
|
|
128
|
-
"react-toastify": "^11.0.
|
|
129
|
-
"socket.io-client": "^4.8.
|
|
127
|
+
"query-string": "^9.3.1",
|
|
128
|
+
"react-toastify": "^11.0.5",
|
|
129
|
+
"socket.io-client": "^4.8.3",
|
|
130
130
|
"uuid": "^11.1.0",
|
|
131
131
|
"zustand": "^5.0.11"
|
|
132
|
-
},
|
|
133
|
-
"pnpm": {
|
|
134
|
-
"overrides": {
|
|
135
|
-
"debug": "4.4.3",
|
|
136
|
-
"chalk": "5.6.2",
|
|
137
|
-
"supports-color": "10.2.2",
|
|
138
|
-
"ansi-styles": "6.2.3"
|
|
139
|
-
}
|
|
140
132
|
}
|
|
141
133
|
}
|