atom.io 0.32.2 → 0.32.3

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 (39) hide show
  1. package/README.md +17 -37
  2. package/data/dist/index.js +1 -1
  3. package/dist/{chunk-YPME5OLO.js → chunk-2XDFCXGB.js} +1 -1
  4. package/dist/{chunk-RXQWAO26.js → chunk-35NB2XZU.js} +103 -109
  5. package/dist/{chunk-XN3EO2UT.js → chunk-EF4S7H42.js} +6 -3
  6. package/dist/{chunk-QRPY4LSO.js → chunk-LTLDKXDN.js} +3 -3
  7. package/dist/{chunk-HEEVASKG.js → chunk-MENOYVPP.js} +1 -1
  8. package/dist/{chunk-KMBRCA5Q.js → chunk-RGUNRT72.js} +33 -31
  9. package/dist/{chunk-NDTM5IY3.js → chunk-TS76LQVD.js} +2 -2
  10. package/dist/index.js +1 -1
  11. package/internal/dist/index.d.ts +7 -4
  12. package/internal/dist/index.js +1 -1
  13. package/internal/src/get-state/read-or-compute-value.ts +23 -13
  14. package/internal/src/index.ts +2 -1
  15. package/internal/src/ingest-updates/ingest-creation-disposal.ts +0 -12
  16. package/internal/src/reserved-keys.ts +7 -0
  17. package/internal/src/set-state/copy-mutable-if-needed.ts +12 -11
  18. package/internal/src/set-state/set-atom-or-selector.ts +1 -1
  19. package/internal/src/set-state/set-atom.ts +43 -21
  20. package/internal/src/store/store.ts +2 -1
  21. package/internal/src/transaction/get-epoch-number.ts +15 -19
  22. package/internal/src/transaction/set-epoch-number.ts +2 -2
  23. package/introspection/dist/index.js +2 -2
  24. package/introspection/src/attach-atom-index.ts +16 -14
  25. package/introspection/src/attach-selector-index.ts +16 -14
  26. package/json/dist/index.js +1 -1
  27. package/package.json +19 -17
  28. package/react/dist/index.js +2 -2
  29. package/react-devtools/dist/index.js +78 -66
  30. package/react-devtools/src/AtomIODevtools.tsx +10 -2
  31. package/react-devtools/src/error-boundary/ReactErrorBoundary.tsx +1 -1
  32. package/realtime/dist/index.js +2 -2
  33. package/realtime-client/dist/index.js +2 -2
  34. package/realtime-client/src/continuity/register-and-attempt-confirmed-update.ts +5 -2
  35. package/realtime-react/dist/index.js +4 -4
  36. package/realtime-server/dist/index.js +3 -3
  37. package/realtime-testing/dist/index.js +6 -6
  38. package/transceivers/set-rtx/dist/index.js +1 -1
  39. package/internal/src/set-state/stow-update.ts +0 -60
@@ -1,5 +1,5 @@
1
1
  import type { ErrorInfo, FC, ReactNode } from "react"
2
- import { Component, useState } from "react"
2
+ import { Component } from "react"
3
3
 
4
4
  import type { FallbackProps } from "./DefaultFallback"
5
5
  import { DefaultFallback } from "./DefaultFallback"
@@ -1,3 +1,3 @@
1
- export { DEFAULT_USER_IN_ROOM_META, InvariantMap, SyncGroup, continuity, roomIndex, usersInMyRoomView, usersInRooms, usersInThisRoomIndex } from '../../dist/chunk-YPME5OLO.js';
2
- import '../../dist/chunk-RXQWAO26.js';
1
+ export { DEFAULT_USER_IN_ROOM_META, InvariantMap, SyncGroup, continuity, roomIndex, usersInMyRoomView, usersInRooms, usersInThisRoomIndex } from '../../dist/chunk-2XDFCXGB.js';
2
+ import '../../dist/chunk-35NB2XZU.js';
3
3
  import '../../dist/chunk-XWL6SNVU.js';
@@ -1,4 +1,4 @@
1
- export { confirmedUpdateQueue, myIdState, myIdState__INTERNAL, myUsernameState, optimisticUpdateQueue, pullAtom, pullAtomFamilyMember, pullMutableAtom, pullMutableAtomFamilyMember, pullSelector, pullSelectorFamilyMember, pushState, serverAction, syncContinuity, useConcealState, useRegisterAndAttemptConfirmedUpdate, useRevealState } from '../../dist/chunk-XN3EO2UT.js';
1
+ export { confirmedUpdateQueue, myIdState, myIdState__INTERNAL, myUsernameState, optimisticUpdateQueue, pullAtom, pullAtomFamilyMember, pullMutableAtom, pullMutableAtomFamilyMember, pullSelector, pullSelectorFamilyMember, pushState, serverAction, syncContinuity, useConcealState, useRegisterAndAttemptConfirmedUpdate, useRevealState } from '../../dist/chunk-EF4S7H42.js';
2
2
  import '../../dist/chunk-4LWKCEW3.js';
3
- import '../../dist/chunk-RXQWAO26.js';
3
+ import '../../dist/chunk-35NB2XZU.js';
4
4
  import '../../dist/chunk-XWL6SNVU.js';
@@ -177,10 +177,13 @@ export const useRegisterAndAttemptConfirmedUpdate =
177
177
  continuityKey,
178
178
  `has no optimistic updates to deal with`,
179
179
  )
180
- const continuityEpoch = getEpochNumberOfContinuity(store, continuityKey)
181
180
  const isRoot = isRootStore(store)
181
+ let continuityEpoch: number | undefined
182
+ if (isRoot) {
183
+ continuityEpoch = getEpochNumberOfContinuity(store, continuityKey)
184
+ }
182
185
 
183
- if (isRoot && continuityEpoch === confirmed.epoch - 1) {
186
+ if (continuityEpoch === confirmed.epoch - 1) {
184
187
  store.logger.info(
185
188
  `✅`,
186
189
  `continuity`,
@@ -1,6 +1,6 @@
1
- export { RealtimeContext, RealtimeProvider, usePullAtom, usePullAtomFamilyMember, usePullMutable, usePullMutableAtomFamilyMember, usePullSelector, usePullSelectorFamilyMember, usePush, useServerAction, useSyncContinuity } from '../../dist/chunk-QRPY4LSO.js';
2
- import '../../dist/chunk-XN3EO2UT.js';
1
+ export { RealtimeContext, RealtimeProvider, usePullAtom, usePullAtomFamilyMember, usePullMutable, usePullMutableAtomFamilyMember, usePullSelector, usePullSelectorFamilyMember, usePush, useServerAction, useSyncContinuity } from '../../dist/chunk-LTLDKXDN.js';
2
+ import '../../dist/chunk-EF4S7H42.js';
3
3
  import '../../dist/chunk-4LWKCEW3.js';
4
- import '../../dist/chunk-HEEVASKG.js';
5
- import '../../dist/chunk-RXQWAO26.js';
4
+ import '../../dist/chunk-MENOYVPP.js';
5
+ import '../../dist/chunk-35NB2XZU.js';
6
6
  import '../../dist/chunk-XWL6SNVU.js';
@@ -1,4 +1,4 @@
1
- export { ChildSocket, CustomSocket, ParentSocket, SubjectSocket, createRoomTX, destroyRoomTX, joinRoomTX, leaveRoomTX, prepareToExposeRealtimeContinuity, realtimeActionReceiver, realtimeAtomFamilyProvider, realtimeMutableFamilyProvider, realtimeMutableProvider, realtimeStateProvider, realtimeStateReceiver, redactTransactionUpdateContent, redactorAtoms, roomArgumentsAtoms, roomSelectors, socketAtoms, socketIndex, userIndex, userUnacknowledgedQueues, usersOfSockets } from '../../dist/chunk-NDTM5IY3.js';
2
- import '../../dist/chunk-YPME5OLO.js';
3
- import '../../dist/chunk-RXQWAO26.js';
1
+ export { ChildSocket, CustomSocket, ParentSocket, SubjectSocket, createRoomTX, destroyRoomTX, joinRoomTX, leaveRoomTX, prepareToExposeRealtimeContinuity, realtimeActionReceiver, realtimeAtomFamilyProvider, realtimeMutableFamilyProvider, realtimeMutableProvider, realtimeStateProvider, realtimeStateReceiver, redactTransactionUpdateContent, redactorAtoms, roomArgumentsAtoms, roomSelectors, socketAtoms, socketIndex, userIndex, userUnacknowledgedQueues, usersOfSockets } from '../../dist/chunk-TS76LQVD.js';
2
+ import '../../dist/chunk-2XDFCXGB.js';
3
+ import '../../dist/chunk-35NB2XZU.js';
4
4
  import '../../dist/chunk-XWL6SNVU.js';
@@ -1,10 +1,10 @@
1
- import { RealtimeProvider } from '../../dist/chunk-QRPY4LSO.js';
2
- import { myUsernameState } from '../../dist/chunk-XN3EO2UT.js';
3
- import { socketAtoms, usersOfSockets, userIndex, socketIndex, roomSelectors } from '../../dist/chunk-NDTM5IY3.js';
4
- import { roomIndex } from '../../dist/chunk-YPME5OLO.js';
1
+ import { RealtimeProvider } from '../../dist/chunk-LTLDKXDN.js';
2
+ import { myUsernameState } from '../../dist/chunk-EF4S7H42.js';
3
+ import { socketAtoms, usersOfSockets, userIndex, socketIndex, roomSelectors } from '../../dist/chunk-TS76LQVD.js';
4
+ import { roomIndex } from '../../dist/chunk-2XDFCXGB.js';
5
5
  import '../../dist/chunk-4LWKCEW3.js';
6
- import { StoreProvider } from '../../dist/chunk-HEEVASKG.js';
7
- import { Silo, IMPLICIT, Realm, findInStore, setIntoStore, editRelationsInStore, toEntries, findRelationsInStore, getFromStore, clearStore, AtomIOLogger } from '../../dist/chunk-RXQWAO26.js';
6
+ import { StoreProvider } from '../../dist/chunk-MENOYVPP.js';
7
+ import { Silo, IMPLICIT, Realm, findInStore, setIntoStore, editRelationsInStore, toEntries, findRelationsInStore, getFromStore, clearStore, AtomIOLogger } from '../../dist/chunk-35NB2XZU.js';
8
8
  import '../../dist/chunk-XWL6SNVU.js';
9
9
  import * as http from 'node:http';
10
10
  import { render, prettyDOM } from '@testing-library/react';
@@ -1,2 +1,2 @@
1
- export { SetRTX } from '../../../dist/chunk-RXQWAO26.js';
1
+ export { SetRTX } from '../../../dist/chunk-35NB2XZU.js';
2
2
  import '../../../dist/chunk-XWL6SNVU.js';
@@ -1,60 +0,0 @@
1
- import type { KeyedStateUpdate, StateUpdate } from "atom.io"
2
-
3
- import type { Atom } from ".."
4
- import { newest } from "../lineage"
5
- import { isTransceiver } from "../mutable"
6
- import type { Store } from "../store"
7
- import { isChildStore } from "../transaction/is-root-store"
8
-
9
- function shouldUpdateBeStowed(key: string, update: StateUpdate<any>): boolean {
10
- // do not stow updates that aren't json
11
- if (isTransceiver(update.newValue)) {
12
- return false
13
- }
14
- // do not stow updates where the key contains 🔍
15
- if (key.includes(`🔍`)) {
16
- return false
17
- }
18
- return true
19
- }
20
-
21
- export const stowUpdate = <T>(
22
- store: Store,
23
- state: Atom<T>,
24
- update: StateUpdate<T>,
25
- ): void => {
26
- const { key } = state
27
- const target = newest(store)
28
- if (!isChildStore(target) || target.transactionMeta.phase !== `building`) {
29
- store.logger.error(
30
- `🐞`,
31
- `atom`,
32
- key,
33
- `stowUpdate called outside of a transaction. This is probably a bug.`,
34
- )
35
- return
36
- }
37
- const shouldStow = shouldUpdateBeStowed(key, update)
38
- if (!shouldStow) {
39
- return
40
- }
41
- const atomUpdate: KeyedStateUpdate<T> = {
42
- type: `atom_update`,
43
- key,
44
- ...update,
45
- }
46
- if (state.family) {
47
- atomUpdate.family = state.family
48
- }
49
- target.transactionMeta.update.updates.push(atomUpdate)
50
- store.logger.info(
51
- `📁`,
52
- `atom`,
53
- key,
54
- `stowed (`,
55
- update.oldValue,
56
- `->`,
57
- update.newValue,
58
- `)`,
59
- )
60
- }