@arcote.tech/arc-react 0.7.13 → 0.7.15
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 +6 -26
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -321,7 +321,9 @@ import { jsx as jsx5 } from "react/jsx-runtime";
|
|
|
321
321
|
var modelProviderFactory = (context, options) => {
|
|
322
322
|
const ModelContext = createContext4(null);
|
|
323
323
|
const commandWire = options.remoteUrl ? new CommandWire(options.remoteUrl) : undefined;
|
|
324
|
-
const eventWire = options.remoteUrl ? new EventWire(options.remoteUrl
|
|
324
|
+
const eventWire = options.remoteUrl ? new EventWire(options.remoteUrl, {
|
|
325
|
+
enableEventSync: !!options.dbAdapterFactory
|
|
326
|
+
}) : undefined;
|
|
325
327
|
const queryWire = options.remoteUrl ? new QueryWire(options.remoteUrl) : undefined;
|
|
326
328
|
const authAdapter = new AuthAdapter;
|
|
327
329
|
authAdapter.loadPersisted();
|
|
@@ -450,28 +452,6 @@ Event payload:`, event.payload);
|
|
|
450
452
|
streamingCache.registerViews(views);
|
|
451
453
|
eventPublisher = new StreamingEventPublisher(streamingCache, eventWire);
|
|
452
454
|
eventPublisher.registerViews(views);
|
|
453
|
-
const processedEvents = new Set;
|
|
454
|
-
let eventQueue = Promise.resolve();
|
|
455
|
-
eventWire.onEvent((event) => {
|
|
456
|
-
eventQueue = eventQueue.then(async () => {
|
|
457
|
-
try {
|
|
458
|
-
if (processedEvents.has(event.hostId)) {
|
|
459
|
-
return;
|
|
460
|
-
}
|
|
461
|
-
processedEvents.add(event.hostId);
|
|
462
|
-
await streamingCache.applyEvent({
|
|
463
|
-
id: event.hostId,
|
|
464
|
-
type: event.type,
|
|
465
|
-
payload: event.payload,
|
|
466
|
-
createdAt: new Date(event.createdAt),
|
|
467
|
-
authContext: event.authContext ?? null
|
|
468
|
-
});
|
|
469
|
-
} catch (error) {
|
|
470
|
-
console.error(`[Arc] Failed to process event ${event.hostId} (${event.type}):`, error);
|
|
471
|
-
processedEvents.delete(event.hostId);
|
|
472
|
-
}
|
|
473
|
-
});
|
|
474
|
-
});
|
|
475
455
|
if (authAdapter.isAuthenticated()) {
|
|
476
456
|
eventWire.connect();
|
|
477
457
|
}
|
|
@@ -604,7 +584,7 @@ Event payload:`, event.payload);
|
|
|
604
584
|
}
|
|
605
585
|
};
|
|
606
586
|
if (adapters.streamingCache) {
|
|
607
|
-
const store = adapters.streamingCache.getStore(desc.element);
|
|
587
|
+
const store = adapters.streamingCache.getStore(desc.element, name);
|
|
608
588
|
let cachedResult;
|
|
609
589
|
unsubs.push(store.subscribe((events) => {
|
|
610
590
|
if (!events) {
|
|
@@ -630,7 +610,7 @@ Event payload:`, event.payload);
|
|
|
630
610
|
}
|
|
631
611
|
reExecute();
|
|
632
612
|
}));
|
|
633
|
-
unsubs.push(adapters.streamingCache.
|
|
613
|
+
unsubs.push(adapters.streamingCache.subscribeView(desc.element, adapters.eventWire, name));
|
|
634
614
|
if (store.hasData()) {
|
|
635
615
|
reExecute();
|
|
636
616
|
}
|
|
@@ -721,4 +701,4 @@ export {
|
|
|
721
701
|
Form
|
|
722
702
|
};
|
|
723
703
|
|
|
724
|
-
//# debugId=
|
|
704
|
+
//# debugId=88FD0E28C6E4167364756E2164756E21
|
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.15",
|
|
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.15",
|
|
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"
|