@arcote.tech/arc-react 0.3.3 → 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.
Files changed (2) hide show
  1. package/dist/index.js +10 -2
  2. 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;
@@ -476,7 +481,10 @@ Event payload:`, event.payload);
476
481
  initializeModel();
477
482
  return () => {
478
483
  cancelled = true;
479
- eventWire?.disconnect();
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=84D132984522BD8664756E2164756E21
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.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.",