@arcote.tech/arc-react 0.7.16 → 0.7.17
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.js
CHANGED
|
@@ -305,7 +305,8 @@ import {
|
|
|
305
305
|
QueryWire,
|
|
306
306
|
StreamingEventPublisher,
|
|
307
307
|
StreamingQueryCache,
|
|
308
|
-
buildContextAccessor
|
|
308
|
+
buildContextAccessor,
|
|
309
|
+
triggerModuleSync
|
|
309
310
|
} from "@arcote.tech/arc";
|
|
310
311
|
import {
|
|
311
312
|
createContext as createContext4,
|
|
@@ -510,18 +511,21 @@ Event payload:`, event.payload);
|
|
|
510
511
|
return scoped;
|
|
511
512
|
}
|
|
512
513
|
function createScope(name) {
|
|
513
|
-
function setToken(token) {
|
|
514
|
+
async function setToken(token) {
|
|
514
515
|
authAdapter.setToken(token, name);
|
|
516
|
+
let syncPromise;
|
|
515
517
|
if (cachedModel) {
|
|
516
|
-
cachedModel.scope(name).setToken(token);
|
|
518
|
+
syncPromise = cachedModel.scope(name).setToken(token);
|
|
517
519
|
cachedModel.getAdapters().streamingCache?.invalidateScope(name, eventWire);
|
|
518
520
|
} else {
|
|
519
521
|
eventWire?.setScopeToken(name, token);
|
|
520
522
|
if (eventWire && token && eventWire.getState() === "disconnected") {
|
|
521
523
|
eventWire.connect();
|
|
522
524
|
}
|
|
525
|
+
syncPromise = triggerModuleSync(name);
|
|
523
526
|
}
|
|
524
527
|
notifyScopeTokenListeners(name);
|
|
528
|
+
await syncPromise;
|
|
525
529
|
}
|
|
526
530
|
function useToken() {
|
|
527
531
|
const [token, setTokenState] = useState3(() => authAdapter.getToken(name));
|
|
@@ -678,4 +682,4 @@ export {
|
|
|
678
682
|
Form
|
|
679
683
|
};
|
|
680
684
|
|
|
681
|
-
//# debugId=
|
|
685
|
+
//# debugId=4CA84684BEAF949D64756E2164756E21
|
|
@@ -21,7 +21,7 @@ export interface ScopeAPI<C extends ArcContextAny = ArcContextAny> {
|
|
|
21
21
|
}>;
|
|
22
22
|
useQuery: () => QueryAccessor<C>;
|
|
23
23
|
useMutation: () => MutationAccessor<C>;
|
|
24
|
-
setToken: (token: string | null) => void
|
|
24
|
+
setToken: (token: string | null) => Promise<void>;
|
|
25
25
|
useToken: () => string | null;
|
|
26
26
|
}
|
|
27
27
|
export declare const modelProviderFactory: <C extends ArcContextAny>(context: C, options: ReactModelOptions) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcote.tech/arc-react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.17",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Przemysław Krasiński [arcote.tech]",
|
|
7
7
|
"description": "React client for the Arc framework, providing utilities for querying data and executing commands, enhancing the development of reactive and efficient user interfaces.",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"typescript": "^5.2.2"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@arcote.tech/arc": "^0.7.
|
|
35
|
+
"@arcote.tech/arc": "^0.7.17",
|
|
36
36
|
"react": "^18.0.0 || ^19.0.0",
|
|
37
37
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
38
38
|
"typescript": "^5.0.0"
|