@arcote.tech/arc-react 0.3.2 → 0.3.4
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 +11 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -318,6 +318,7 @@ var modelProviderFactory = (context, options) => {
|
|
|
318
318
|
let cachedModel = null;
|
|
319
319
|
let cachedDataStorage = null;
|
|
320
320
|
let onResetCallback = null;
|
|
321
|
+
let needsReconnect = false;
|
|
321
322
|
function ModelProvider(props) {
|
|
322
323
|
const [model, setModel] = useState3(cachedModel);
|
|
323
324
|
const [resetTrigger, setResetTrigger] = useState3(0);
|
|
@@ -333,6 +334,10 @@ var modelProviderFactory = (context, options) => {
|
|
|
333
334
|
useEffect2(() => {
|
|
334
335
|
if (initialized && cachedModel) {
|
|
335
336
|
setModel(cachedModel);
|
|
337
|
+
if (needsReconnect && eventWire && authAdapter.isAuthenticated()) {
|
|
338
|
+
eventWire.connect();
|
|
339
|
+
needsReconnect = false;
|
|
340
|
+
}
|
|
336
341
|
return;
|
|
337
342
|
}
|
|
338
343
|
initialized = true;
|
|
@@ -341,7 +346,7 @@ var modelProviderFactory = (context, options) => {
|
|
|
341
346
|
let dataStorage;
|
|
342
347
|
let eventPublisher;
|
|
343
348
|
let streamingCache;
|
|
344
|
-
const views = context.elements.filter((element) => ("getHandlers" in element) && ("databaseStoreSchema" in element) && ("schema" in element));
|
|
349
|
+
const views = context.elements.filter((element) => element && ("getHandlers" in element) && ("databaseStoreSchema" in element) && ("schema" in element));
|
|
345
350
|
if (options.dbAdapterFactory) {
|
|
346
351
|
const databaseAdapter = await options.dbAdapterFactory(context);
|
|
347
352
|
if (cancelled)
|
|
@@ -476,7 +481,10 @@ Event payload:`, event.payload);
|
|
|
476
481
|
initializeModel();
|
|
477
482
|
return () => {
|
|
478
483
|
cancelled = true;
|
|
479
|
-
eventWire
|
|
484
|
+
if (eventWire) {
|
|
485
|
+
needsReconnect = true;
|
|
486
|
+
eventWire.disconnect();
|
|
487
|
+
}
|
|
480
488
|
};
|
|
481
489
|
}, [resetTrigger]);
|
|
482
490
|
if (!model)
|
|
@@ -596,4 +604,4 @@ export {
|
|
|
596
604
|
Form
|
|
597
605
|
};
|
|
598
606
|
|
|
599
|
-
//# debugId=
|
|
607
|
+
//# debugId=AB2860A19A07A53D64756E2164756E21
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcote.tech/arc-react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.4",
|
|
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.",
|