@instantdb/react-common 1.0.50-branch-log-dashboard-login-code.29876046282.1 → 1.0.50
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/commonjs/InstantReactAbstractDatabase.d.ts +1 -14
- package/dist/commonjs/InstantReactAbstractDatabase.d.ts.map +1 -1
- package/dist/commonjs/InstantReactAbstractDatabase.js +0 -30
- package/dist/commonjs/InstantReactAbstractDatabase.js.map +1 -1
- package/dist/esm/InstantReactAbstractDatabase.d.ts +1 -14
- package/dist/esm/InstantReactAbstractDatabase.d.ts.map +1 -1
- package/dist/esm/InstantReactAbstractDatabase.js +0 -30
- package/dist/esm/InstantReactAbstractDatabase.js.map +1 -1
- package/dist/standalone/index.js +839 -921
- package/dist/standalone/index.umd.cjs +11 -11
- package/package.json +3 -3
- package/src/InstantReactAbstractDatabase.tsx +0 -42
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instantdb/react-common",
|
|
3
|
-
"version": "1.0.50
|
|
3
|
+
"version": "1.0.50",
|
|
4
4
|
"description": "Instant DB shared components for React and React Native",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/instantdb/instant/tree/main/client/packages/react-common",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"react": ">=16"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@instantdb/
|
|
58
|
-
"@instantdb/
|
|
57
|
+
"@instantdb/version": "1.0.50",
|
|
58
|
+
"@instantdb/core": "1.0.50"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"test": "vitest",
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
type AuthState,
|
|
8
8
|
type User,
|
|
9
9
|
type ConnectionStatus,
|
|
10
|
-
type AppStatusState,
|
|
11
10
|
type TransactionChunk,
|
|
12
11
|
type RoomSchemaShape,
|
|
13
12
|
type InstaQLOptions,
|
|
@@ -45,11 +44,6 @@ const defaultAuthState = {
|
|
|
45
44
|
error: undefined,
|
|
46
45
|
};
|
|
47
46
|
|
|
48
|
-
const defaultAppStatusState: AppStatusState = {
|
|
49
|
-
isLoading: true,
|
|
50
|
-
isReadOnly: undefined,
|
|
51
|
-
};
|
|
52
|
-
|
|
53
47
|
export default abstract class InstantReactAbstractDatabase<
|
|
54
48
|
// need to pull this schema out to another generic for query params, not sure why
|
|
55
49
|
Schema extends InstantSchemaDef<any, any, any>,
|
|
@@ -377,42 +371,6 @@ export default abstract class InstantReactAbstractDatabase<
|
|
|
377
371
|
return status;
|
|
378
372
|
};
|
|
379
373
|
|
|
380
|
-
/**
|
|
381
|
-
* Observe the app's maintenance-mode state. While read-only, reads and
|
|
382
|
-
* live queries keep working but writes are rejected.
|
|
383
|
-
*
|
|
384
|
-
* @example
|
|
385
|
-
* function App() {
|
|
386
|
-
* const { isLoading, isReadOnly } = db.useAppStatus()
|
|
387
|
-
* if (isLoading) return null
|
|
388
|
-
* if (isReadOnly) return <MaintenanceBanner />
|
|
389
|
-
* // ...
|
|
390
|
-
* }
|
|
391
|
-
*/
|
|
392
|
-
useAppStatus = (): AppStatusState => {
|
|
393
|
-
const stateRef = useRef<AppStatusState>(this.core._reactor._appStatusState);
|
|
394
|
-
|
|
395
|
-
const subscribe = useCallback((cb: () => void) => {
|
|
396
|
-
return this.core.subscribeAppStatus((state) => {
|
|
397
|
-
if (
|
|
398
|
-
state.isLoading !== stateRef.current.isLoading ||
|
|
399
|
-
state.isReadOnly !== stateRef.current.isReadOnly
|
|
400
|
-
) {
|
|
401
|
-
stateRef.current = state;
|
|
402
|
-
cb();
|
|
403
|
-
}
|
|
404
|
-
});
|
|
405
|
-
}, []);
|
|
406
|
-
|
|
407
|
-
const state = useSyncExternalStore<AppStatusState>(
|
|
408
|
-
subscribe,
|
|
409
|
-
() => stateRef.current,
|
|
410
|
-
() => defaultAppStatusState,
|
|
411
|
-
);
|
|
412
|
-
|
|
413
|
-
return state;
|
|
414
|
-
};
|
|
415
|
-
|
|
416
374
|
/**
|
|
417
375
|
* Use this for one-off queries.
|
|
418
376
|
* Returns local data if available, otherwise fetches from the server.
|