@oimdb/react 3.0.0 → 3.2.0

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.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { DependencyList } from 'react';
3
- import { OIMDB, TOIMSlot, TOIMComputedSlot, TOIMStoreKey, OIMSlotCollectionService, TOIMEntitySlot, TOIMStoreSlot, OIMSingleSlotService, TOIMSingleSlotStore, TOIMBucketSlot, OIMSlotContentBucketService, TOIMEntityColumnName, TOIMColumnSlot, TOIMEntityColumnValue, TOIMIndexableSlot, OIMComputedService, TOIMComputedSources, TOIMComputedStoreSlot } from '@oimdb/core';
3
+ import { OIMDB, TOIMSlot, TOIMComputedContentSlot, TOIMStoreKey, TOIMStoreSlot, TOIMEntitySlot, OIMSlotCollectionService, TOIMSingleSlotStore, TOIMEntityContentSlot, OIMSingleSlotService, TOIMBucketContentSlot, OIMSlotContentBucketService, TOIMEntityColumnName, OIMColumnSlotService, TOIMColumnSlot, OIMColumnSlotOwner, TOIMEntityColumnValue, TOIMBucketSlot, TOIMIndexableSlot, TOIMComputedSlot, OIMSingleComputedService, TOIMComputedSources, OIMComputedService, TOIMComputedStoreSlot } from '@oimdb/core';
4
4
 
5
5
  declare const OIMDBContext: React.Context<OIMDB | undefined>;
6
6
 
@@ -13,7 +13,7 @@ declare function useOIMDB(): OIMDB;
13
13
 
14
14
  type TOIMBinding<TValue> = {
15
15
  readonly sourceSlots?: readonly TOIMSlot[] | undefined;
16
- readonly sourceComputeds?: readonly TOIMComputedSlot[] | undefined;
16
+ readonly sourceComputeds?: readonly TOIMComputedContentSlot[] | undefined;
17
17
  readonly derive: () => TValue;
18
18
  };
19
19
 
@@ -26,32 +26,36 @@ type TOIMBinding<TValue> = {
26
26
  */
27
27
  declare function useOIMValue<TValue>(binding: TOIMBinding<TValue>): TValue;
28
28
 
29
- declare function useOIMComputedValue<TValue>(computedSlot: TOIMComputedSlot<TValue>): TValue;
29
+ declare function useOIMComputedValue<TValue>(computedSlot: TOIMComputedContentSlot<TValue>): TValue;
30
30
 
31
- declare function useOIMEntity<TEntity extends object, TKey = TOIMStoreKey, TStore = unknown>(entityCollectionService: Pick<OIMSlotCollectionService<TKey, TOIMEntitySlot<TEntity, TKey>, TStore, unknown>, 'getSlotByKey' | 'holdSlotByKey'>, entityStoreSlot: TOIMStoreSlot<TStore, TOIMEntitySlot<TEntity, TKey>>, key: TKey): TEntity | undefined;
31
+ declare function useOIMEntity<TEntity extends object, TKey extends NonNullable<unknown> = TOIMStoreKey, TStore = unknown>(entityStoreSlot: TOIMStoreSlot<TStore, TOIMEntitySlot<TEntity, TKey>, unknown, Pick<OIMSlotCollectionService<TKey, TOIMEntitySlot<TEntity, TKey>, TStore, unknown>, 'getSlotByKey' | 'holdSlotByKey'>>, key: TKey): TEntity | undefined;
32
32
 
33
- declare function useOIMSingleEntity<TEntity extends object>(singleSlotService: Pick<OIMSingleSlotService<TOIMEntitySlot<TEntity, void>, unknown>, 'getSingleSlot' | 'holdSingleSlot'>, singleSlotStoreSlot: TOIMStoreSlot<TOIMSingleSlotStore<TOIMEntitySlot<TEntity, void>>, TOIMEntitySlot<TEntity, void>>): TEntity | undefined;
33
+ declare function useOIMSingleEntity<TEntity extends object>(singleSlotStoreSlot: TOIMStoreSlot<TOIMSingleSlotStore<TOIMEntityContentSlot<TEntity>>, TOIMEntityContentSlot<TEntity>, unknown, Pick<OIMSingleSlotService<TOIMEntityContentSlot<TEntity>, unknown>, 'getSingleSlot' | 'holdSingleSlot'>>): TEntity | undefined;
34
34
 
35
- declare function useOIMSingleBucketSlots<TEntity extends object, TSlots = unknown>(singleSlotService: Pick<OIMSingleSlotService<TOIMBucketSlot<TSlots, void>, Pick<OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots>, 'getBucketMemberSlots'>>, 'getSingleSlot' | 'holdSingleSlot' | 'slotContentService'>, singleSlotStoreSlot: TOIMStoreSlot<TOIMSingleSlotStore<TOIMBucketSlot<TSlots, void>>, TOIMBucketSlot<TSlots, void>>): readonly TOIMEntitySlot<TEntity>[];
35
+ declare function useOIMSingleBucketSlots<TEntity extends object, TSlots = unknown>(singleSlotStoreSlot: TOIMStoreSlot<TOIMSingleSlotStore<TOIMBucketContentSlot<TSlots>>, TOIMBucketContentSlot<TSlots>, unknown, Pick<OIMSingleSlotService<TOIMBucketContentSlot<TSlots>, Pick<OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots>, 'getBucketMemberSlots'>>, 'getSingleSlot' | 'holdSingleSlot' | 'slotContentService'>>): readonly TOIMEntitySlot<TEntity>[];
36
36
 
37
37
  /**
38
38
  * One field of one identity. It cannot go through {@link useOIMValue}: a column identity is
39
39
  * minted INSIDE the subscription, so there is no root slot a binding could name. `slot` is an
40
40
  * ENTITY SLOT because an entity slot is what can be taken out from under this component — ../README.md.
41
41
  */
42
- declare function useOIMField<TEntity extends object, TName extends TOIMEntityColumnName<TEntity>, TKey = TOIMStoreKey>(entityCollectionService: Pick<OIMSlotCollectionService<TKey, TOIMEntitySlot<TEntity, TKey>, unknown, unknown, TName, TOIMColumnSlot>, 'getColumn'>, slot: TOIMEntitySlot<TEntity, TKey>, name: TName): TOIMEntityColumnValue<TEntity, TName> | undefined;
42
+ declare function useOIMField<TEntity extends object, TName extends TOIMEntityColumnName<TEntity>, TKey extends NonNullable<unknown> = TOIMStoreKey>(entityCollectionService: {
43
+ readonly columnSlotService: Pick<OIMColumnSlotService<TOIMEntitySlot<TEntity, TKey>, TName, TOIMColumnSlot, OIMColumnSlotOwner<TOIMSlot, TOIMColumnSlot>>, 'getColumn'>;
44
+ }, slot: TOIMEntitySlot<TEntity, TKey>, name: TName): TOIMEntityColumnValue<TEntity, TName> | undefined;
43
45
 
44
46
  /** A bucket's slots, copied out of the service's LIVE container, in the collection's order. */
45
- declare function useOIMBucketSlots<TEntity extends object, TSlots = unknown>(bucketCollectionService: Pick<OIMSlotCollectionService<unknown, TOIMBucketSlot<TSlots>, unknown, Pick<OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots>, 'getBucketMemberSlots'>>, 'slotContentService'>, bucketSlot: TOIMBucketSlot<TSlots>): readonly TOIMEntitySlot<TEntity>[];
47
+ declare function useOIMBucketSlots<TEntity extends object, TSlots = unknown>(bucketCollectionService: {
48
+ readonly slotContentService: Pick<OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots>, 'getBucketMemberSlots'>;
49
+ }, bucketSlot: TOIMBucketContentSlot<TSlots>): readonly TOIMEntitySlot<TEntity>[];
46
50
 
47
- declare function useOIMBucketSlotsByKey<TEntity extends object, TSlots = unknown, TKey = TOIMStoreKey, TStore = unknown>(bucketCollectionService: Pick<OIMSlotCollectionService<TKey, TOIMBucketSlot<TSlots, TKey>, TStore, Pick<OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots>, 'getBucketMemberSlots'>>, 'getSlotByKey' | 'holdSlotByKey' | 'slotContentService'>, bucketStoreSlot: TOIMStoreSlot<TStore, TOIMBucketSlot<TSlots, TKey>>, key: TKey): readonly TOIMEntitySlot<TEntity>[];
51
+ declare function useOIMBucketSlotsByKey<TEntity extends object, TSlots = unknown, TKey extends NonNullable<unknown> = TOIMStoreKey, TStore = unknown>(bucketStoreSlot: TOIMStoreSlot<TStore, TOIMBucketSlot<TSlots, TKey>, unknown, Pick<OIMSlotCollectionService<TKey, TOIMBucketSlot<TSlots, TKey>, TStore, Pick<OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots>, 'getBucketMemberSlots'>>, 'getSlotByKey' | 'holdSlotByKey' | 'slotContentService'>>, key: TKey): readonly TOIMEntitySlot<TEntity>[];
48
52
 
49
- declare function useOIMSlotsByKeys<TKey, TSlot extends TOIMIndexableSlot<TKey>, TStore = unknown>(slotCollectionService: Pick<OIMSlotCollectionService<TKey, TSlot, TStore, unknown>, 'getSlotByKey' | 'holdSlotByKey'>, storeSlot: TOIMStoreSlot<TStore, TSlot>, keys: readonly TKey[]): readonly TSlot[];
53
+ declare function useOIMSlotsByKeys<TKey extends NonNullable<unknown>, TSlot extends TOIMIndexableSlot<TKey>, TStore = unknown>(storeSlot: TOIMStoreSlot<TStore, TSlot, unknown, Pick<OIMSlotCollectionService<TKey, TSlot, TStore, unknown>, 'getSlotByKey' | 'holdSlotByKey'>>, keys: readonly TKey[]): readonly TSlot[];
50
54
 
51
- declare function useOIMComputedValueByKey<TValue, TKey = TOIMStoreKey, TStore = unknown>(computedCollectionService: Pick<OIMSlotCollectionService<TKey, TOIMComputedSlot<TValue, TKey>, TStore, unknown>, 'getSlotByKey' | 'holdSlotByKey'>, computedStoreSlot: TOIMStoreSlot<TStore, TOIMComputedSlot<TValue, TKey>>, key: TKey): TValue;
55
+ declare function useOIMComputedValueByKey<TValue, TKey extends NonNullable<unknown> = TOIMStoreKey, TStore = unknown>(computedStoreSlot: TOIMStoreSlot<TStore, TOIMComputedSlot<TValue, TKey>, unknown, Pick<OIMSlotCollectionService<TKey, TOIMComputedSlot<TValue, TKey>, TStore, unknown>, 'getSlotByKey' | 'holdSlotByKey'>>, key: TKey): TValue;
52
56
 
53
- declare function useOIMSingleComputedValue<TValue>(computedService: OIMComputedService<void, TValue, TOIMSingleSlotStore<TOIMComputedSlot<TValue, void>>>, derive: ((computedSlot: TOIMComputedSlot<TValue, void>) => TValue) | undefined, createSources: ((key: void, storeSlot: TOIMStoreSlot | undefined) => Partial<TOIMComputedSources>) | undefined, dependencyList: DependencyList): TValue;
57
+ declare function useOIMSingleComputedValue<TValue>(computedService: OIMSingleComputedService<TValue>, derive: ((computedSlot: TOIMComputedContentSlot<TValue>) => TValue) | undefined, createSources: ((computedSlot: TOIMComputedContentSlot<TValue>) => Partial<TOIMComputedSources>) | undefined, dependencyList: DependencyList): TValue;
54
58
 
55
- declare function useOIMComputedCollection<TKey, TValue, TStore>(computedService: OIMComputedService<TKey, TValue, TStore>, derive: ((computedSlot: TOIMComputedSlot<TValue, TKey>) => TValue) | undefined, createSources: ((key: TKey, storeSlot: TOIMStoreSlot | undefined) => Partial<TOIMComputedSources>) | undefined, dependencyList: DependencyList): TOIMComputedStoreSlot<TStore, TValue, TKey>;
59
+ declare function useOIMComputedCollection<TKey extends NonNullable<unknown>, TValue, TStore>(computedService: OIMComputedService<TKey, TValue, TStore>, derive: ((computedSlot: TOIMComputedSlot<TValue, TKey>) => TValue) | undefined, createSources: ((computedSlot: TOIMComputedSlot<TValue, TKey>) => Partial<TOIMComputedSources>) | undefined, dependencyList: DependencyList): TOIMComputedStoreSlot<TStore, TValue, TOIMComputedSlot<TValue, TKey>, OIMComputedService<TKey, TValue, TStore>['computedCollectionService']>;
56
60
 
57
61
  export { OIMDBContext, OIMDBProvider, type TOIMBinding, useOIMBucketSlots, useOIMBucketSlotsByKey, useOIMComputedCollection, useOIMComputedValue, useOIMComputedValueByKey, useOIMDB, useOIMEntity, useOIMField, useOIMSingleBucketSlots, useOIMSingleComputedValue, useOIMSingleEntity, useOIMSlotsByKeys, useOIMValue };
package/dist/index.js CHANGED
@@ -31,12 +31,12 @@ var OIMSnapshotVersion = class {
31
31
  this.version = 0;
32
32
  this.getVersion = () => this.version;
33
33
  }
34
- subscribeEffect(channelMap, sourceSlots, sourceComputeds, onStoreChange) {
34
+ subscribeEffect(channelMap, onStoreChange, sourceSlots, sourceComputeds) {
35
35
  this.version++;
36
- return OIMEffectService.INSTANCE.subscribeEffect(channelMap, sourceSlots, sourceComputeds, () => {
36
+ return OIMEffectService.INSTANCE.subscribeEffect(channelMap, () => {
37
37
  this.version++;
38
38
  onStoreChange();
39
- });
39
+ }, sourceSlots, sourceComputeds);
40
40
  }
41
41
  };
42
42
 
@@ -56,9 +56,9 @@ function useOIMValue(binding) {
56
56
  snapshotVersion,
57
57
  subscribe: (onStoreChange) => snapshotVersion.subscribeEffect(
58
58
  db,
59
+ onStoreChange,
59
60
  binding.sourceSlots ?? OIM_FROZEN_EMPTY_SLOTS,
60
- sourceComputeds,
61
- onStoreChange
61
+ sourceComputeds
62
62
  )
63
63
  };
64
64
  }, [db, binding, sourceComputeds]);
@@ -83,17 +83,28 @@ import { OIM_FROZEN_EMPTY_SLOTS as OIM_FROZEN_EMPTY_SLOTS2 } from "@oimdb/core";
83
83
 
84
84
  // src/oimAssertOneChannel.ts
85
85
  function oimAssertOneChannel(channelMap, slot, door) {
86
- const storeSlot = slot.storeSlot;
87
- if (storeSlot === void 0 || storeSlot.channelSlot === channelMap.defaultChannelSlot) return;
86
+ if (slot.storeSlot.channelSlot === channelMap.defaultChannelSlot) return;
88
87
  throw new Error(
89
88
  `${door}: the slot was filed on another OIMDB than the one <OIMDBProvider> was given, so a write would never wake this component. Build the services and their store slots on the one OIMDB the provider holds.`
90
89
  );
91
90
  }
92
91
 
92
+ // src/oimSubscribeHeldSlot.ts
93
+ function oimSubscribeHeldSlot(channelMap, hookName, snapshotVersion, holdingSlot, sourcesOfSlot, onStoreChange) {
94
+ try {
95
+ oimAssertOneChannel(channelMap, holdingSlot, hookName);
96
+ const [sourceSlots, sourceComputeds] = sourcesOfSlot(holdingSlot);
97
+ return snapshotVersion.subscribeEffect(channelMap, onStoreChange, sourceSlots, sourceComputeds);
98
+ } finally {
99
+ holdingSlot.owner.unholdSlot(holdingSlot);
100
+ }
101
+ }
102
+
93
103
  // src/useOIMSlotByKey.ts
94
104
  var sourcesOfRootSlot = (rootSlot) => [[rootSlot], OIM_FROZEN_EMPTY_SLOTS2];
95
- function useOIMSlotByKey(hookName, slotCollectionService, storeSlot, key, sourcesOfSlot = sourcesOfRootSlot) {
105
+ function useOIMSlotByKey(hookName, storeSlot, key, sourcesOfSlot = sourcesOfRootSlot) {
96
106
  const db = useOIMDB();
107
+ const slotCollectionService = storeSlot.slotService;
97
108
  const lastSeenKeyRef = useRef(key);
98
109
  const settledKeyRef = useRef(key);
99
110
  if (key !== lastSeenKeyRef.current) {
@@ -110,18 +121,12 @@ function useOIMSlotByKey(hookName, slotCollectionService, storeSlot, key, source
110
121
  snapshotVersion,
111
122
  subscribe: (onStoreChange) => {
112
123
  const holdingSlot = slotCollectionService.holdSlotByKey(storeSlot, settledKey);
113
- try {
114
- oimAssertOneChannel(db, holdingSlot, hookName);
115
- const [sourceSlots, sourceComputeds] = sourcesOfSlot(holdingSlot);
116
- const disposeEffect = snapshotVersion.subscribeEffect(db, sourceSlots, sourceComputeds, onStoreChange);
117
- subscribedSlot = holdingSlot;
118
- return () => {
119
- subscribedSlot = void 0;
120
- disposeEffect();
121
- };
122
- } finally {
123
- holdingSlot.owner.unholdSlot(holdingSlot);
124
- }
124
+ const effectDisposer = oimSubscribeHeldSlot(db, hookName, snapshotVersion, holdingSlot, sourcesOfSlot, onStoreChange);
125
+ subscribedSlot = holdingSlot;
126
+ return () => {
127
+ subscribedSlot = void 0;
128
+ effectDisposer();
129
+ };
125
130
  },
126
131
  getSlot: () => subscribedSlot ?? slotCollectionService.getSlotByKey(storeSlot, settledKey)
127
132
  };
@@ -131,14 +136,17 @@ function useOIMSlotByKey(hookName, slotCollectionService, storeSlot, key, source
131
136
  }
132
137
 
133
138
  // src/useOIMEntity.ts
134
- function useOIMEntity(entityCollectionService, entityStoreSlot, key) {
135
- return useOIMSlotByKey("useOIMEntity", entityCollectionService, entityStoreSlot, key).entity;
139
+ function useOIMEntity(entityStoreSlot, key) {
140
+ return useOIMSlotByKey("useOIMEntity", entityStoreSlot, key).entity;
136
141
  }
137
142
 
138
143
  // src/useOIMSingleSlot.ts
139
144
  import { useMemo as useMemo4 } from "react";
140
- function useOIMSingleSlot(hookName, singleSlotService, singleSlotStoreSlot) {
145
+ import { OIM_FROZEN_EMPTY_SLOTS as OIM_FROZEN_EMPTY_SLOTS3 } from "@oimdb/core";
146
+ var sourcesOfRootSlot2 = (rootSlot) => [[rootSlot], OIM_FROZEN_EMPTY_SLOTS3];
147
+ function useOIMSingleSlot(hookName, singleSlotStoreSlot, sourcesOfSlot = sourcesOfRootSlot2) {
141
148
  const db = useOIMDB();
149
+ const singleSlotService = singleSlotStoreSlot.slotService;
142
150
  const store = useMemo4(() => {
143
151
  const snapshotVersion = new OIMSnapshotVersion();
144
152
  let subscribedSlot = void 0;
@@ -146,34 +154,29 @@ function useOIMSingleSlot(hookName, singleSlotService, singleSlotStoreSlot) {
146
154
  snapshotVersion,
147
155
  subscribe: (onStoreChange) => {
148
156
  const holdingSlot = singleSlotService.holdSingleSlot(singleSlotStoreSlot);
149
- try {
150
- oimAssertOneChannel(db, holdingSlot, hookName);
151
- const disposeEffect = snapshotVersion.subscribeEffect(db, [holdingSlot], [], onStoreChange);
152
- subscribedSlot = holdingSlot;
153
- return () => {
154
- subscribedSlot = void 0;
155
- disposeEffect();
156
- };
157
- } finally {
158
- holdingSlot.owner.unholdSlot(holdingSlot);
159
- }
157
+ const effectDisposer = oimSubscribeHeldSlot(db, hookName, snapshotVersion, holdingSlot, sourcesOfSlot, onStoreChange);
158
+ subscribedSlot = holdingSlot;
159
+ return () => {
160
+ subscribedSlot = void 0;
161
+ effectDisposer();
162
+ };
160
163
  },
161
164
  getSlot: () => subscribedSlot ?? singleSlotService.getSingleSlot(singleSlotStoreSlot)
162
165
  };
163
- }, [hookName, db, singleSlotService, singleSlotStoreSlot]);
166
+ }, [hookName, db, singleSlotService, singleSlotStoreSlot, sourcesOfSlot]);
164
167
  useOIMSnapshotVersion(store.snapshotVersion, store.subscribe);
165
168
  return store.getSlot();
166
169
  }
167
170
 
168
171
  // src/useOIMSingleEntity.ts
169
- function useOIMSingleEntity(singleSlotService, singleSlotStoreSlot) {
170
- return useOIMSingleSlot("useOIMSingleEntity", singleSlotService, singleSlotStoreSlot).entity;
172
+ function useOIMSingleEntity(singleSlotStoreSlot) {
173
+ return useOIMSingleSlot("useOIMSingleEntity", singleSlotStoreSlot).entity;
171
174
  }
172
175
 
173
176
  // src/useOIMSingleBucketSlots.ts
174
- function useOIMSingleBucketSlots(singleSlotService, singleSlotStoreSlot) {
175
- const bucketSlot = useOIMSingleSlot("useOIMSingleBucketSlots", singleSlotService, singleSlotStoreSlot);
176
- return Array.from(singleSlotService.slotContentService.getBucketMemberSlots(bucketSlot));
177
+ function useOIMSingleBucketSlots(singleSlotStoreSlot) {
178
+ const bucketSlot = useOIMSingleSlot("useOIMSingleBucketSlots", singleSlotStoreSlot);
179
+ return Array.from(singleSlotStoreSlot.slotService.slotContentService.getBucketMemberSlots(bucketSlot));
177
180
  }
178
181
 
179
182
  // src/useOIMField.ts
@@ -213,9 +216,8 @@ function useOIMField(entityCollectionService, slot, name) {
213
216
  snapshotVersion,
214
217
  subscribe: (onStoreChange) => holdWhileSubscribed(holds, () => snapshotVersion.subscribeEffect(
215
218
  db,
216
- [entityCollectionService.getColumn(slot, name)],
217
- [],
218
- onStoreChange
219
+ onStoreChange,
220
+ [entityCollectionService.columnSlotService.getColumn(slot, name)]
219
221
  ))
220
222
  };
221
223
  }, [db, entityCollectionService, slot, name]);
@@ -240,15 +242,15 @@ function useOIMBucketSlots(bucketCollectionService, bucketSlot) {
240
242
  }
241
243
 
242
244
  // src/useOIMBucketSlotsByKey.ts
243
- function useOIMBucketSlotsByKey(bucketCollectionService, bucketStoreSlot, key) {
244
- const bucketSlot = useOIMSlotByKey("useOIMBucketSlotsByKey", bucketCollectionService, bucketStoreSlot, key);
245
- return Array.from(bucketCollectionService.slotContentService.getBucketMemberSlots(bucketSlot));
245
+ function useOIMBucketSlotsByKey(bucketStoreSlot, key) {
246
+ const bucketSlot = useOIMSlotByKey("useOIMBucketSlotsByKey", bucketStoreSlot, key);
247
+ return Array.from(bucketStoreSlot.slotService.slotContentService.getBucketMemberSlots(bucketSlot));
246
248
  }
247
249
 
248
250
  // src/useOIMSlotsByKeys.ts
249
251
  import { useEffect, useRef as useRef2, useState } from "react";
250
252
  import { oimSameKeySequence } from "@oimdb/core";
251
- function useOIMSlotsByKeys(slotCollectionService, storeSlot, keys) {
253
+ function useOIMSlotsByKeys(storeSlot, keys) {
252
254
  const settledKeys = useRef2(keys);
253
255
  const previousKeys = settledKeys.current;
254
256
  if (!oimSameKeySequence(previousKeys, keys)) settledKeys.current = keys;
@@ -256,16 +258,14 @@ function useOIMSlotsByKeys(slotCollectionService, storeSlot, keys) {
256
258
  const [, resolveAgain] = useState(0);
257
259
  const resolvedSlots = useRef2(void 0);
258
260
  const resolvedKeys = useRef2(keysToHold);
259
- const resolvedSlotCollectionService = useRef2(slotCollectionService);
260
261
  const resolvedStoreSlot = useRef2(storeSlot);
261
- if (resolvedSlots.current === void 0 || resolvedKeys.current !== keysToHold || resolvedSlotCollectionService.current !== slotCollectionService || resolvedStoreSlot.current !== storeSlot) {
262
+ if (resolvedSlots.current === void 0 || resolvedKeys.current !== keysToHold || resolvedStoreSlot.current !== storeSlot) {
262
263
  const slots2 = [];
263
264
  for (let i = 0; i < keysToHold.length; i++) {
264
- slots2.push(slotCollectionService.getSlotByKey(storeSlot, keysToHold[i]));
265
+ slots2.push(storeSlot.slotService.getSlotByKey(storeSlot, keysToHold[i]));
265
266
  }
266
267
  resolvedSlots.current = slots2;
267
268
  resolvedKeys.current = keysToHold;
268
- resolvedSlotCollectionService.current = slotCollectionService;
269
269
  resolvedStoreSlot.current = storeSlot;
270
270
  }
271
271
  const slots = resolvedSlots.current;
@@ -274,7 +274,7 @@ function useOIMSlotsByKeys(slotCollectionService, storeSlot, keys) {
274
274
  const heldSlots = [];
275
275
  let someKeyNamesAnotherIdentityNow = false;
276
276
  for (let i = 0; i < keysToHold.length; i++) {
277
- const slot = slotCollectionService.holdSlotByKey(storeSlot, keysToHold[i]);
277
+ const slot = storeSlot.slotService.holdSlotByKey(storeSlot, keysToHold[i]);
278
278
  heldSlots.push(slot);
279
279
  if (slot !== renderedSlots?.[i]) someKeyNamesAnotherIdentityNow = true;
280
280
  }
@@ -288,26 +288,22 @@ function useOIMSlotsByKeys(slotCollectionService, storeSlot, keys) {
288
288
  heldSlot.owner.unholdSlot(heldSlot);
289
289
  }
290
290
  };
291
- }, [slotCollectionService, storeSlot, keysToHold]);
291
+ }, [storeSlot, keysToHold]);
292
292
  return slots;
293
293
  }
294
294
 
295
295
  // src/useOIMComputedValueByKey.ts
296
- import { OIM_FROZEN_EMPTY_SLOTS as OIM_FROZEN_EMPTY_SLOTS3 } from "@oimdb/core";
297
- var sourcesOfComputedSlot = (computedSlot) => [OIM_FROZEN_EMPTY_SLOTS3, [computedSlot]];
298
- function useOIMComputedValueByKey(computedCollectionService, computedStoreSlot, key) {
299
- const computedSlot = useOIMSlotByKey(
300
- "useOIMComputedValueByKey",
301
- computedCollectionService,
302
- computedStoreSlot,
303
- key,
304
- sourcesOfComputedSlot
305
- );
296
+ import { OIM_FROZEN_EMPTY_SLOTS as OIM_FROZEN_EMPTY_SLOTS4 } from "@oimdb/core";
297
+ var sourcesOfComputedSlot = (computedSlot) => [OIM_FROZEN_EMPTY_SLOTS4, [computedSlot]];
298
+ function useOIMComputedValueByKey(computedStoreSlot, key) {
299
+ const computedSlot = useOIMSlotByKey("useOIMComputedValueByKey", computedStoreSlot, key, sourcesOfComputedSlot);
306
300
  return computedSlot.computedValueService.getValueForSlot(computedSlot);
307
301
  }
308
302
 
309
303
  // src/useOIMSingleComputedValue.ts
310
304
  import { useMemo as useMemo7 } from "react";
305
+ import { OIM_FROZEN_EMPTY_SLOTS as OIM_FROZEN_EMPTY_SLOTS5 } from "@oimdb/core";
306
+ var sourcesOfComputedSlot2 = (computedSlot) => [OIM_FROZEN_EMPTY_SLOTS5, [computedSlot]];
311
307
  function useOIMSingleComputedValue(computedService, derive, createSources, dependencyList) {
312
308
  const db = useOIMDB();
313
309
  const computedStoreSlot = useMemo7(
@@ -315,11 +311,8 @@ function useOIMSingleComputedValue(computedService, derive, createSources, depen
315
311
  // eslint-disable-next-line react-hooks/exhaustive-deps -- the caller's list is checked at the call site
316
312
  [db, computedService, ...dependencyList]
317
313
  );
318
- return useOIMComputedValueByKey(
319
- computedService.computedCollectionService,
320
- computedStoreSlot,
321
- void 0
322
- );
314
+ const computedSlot = useOIMSingleSlot("useOIMSingleComputedValue", computedStoreSlot, sourcesOfComputedSlot2);
315
+ return computedSlot.computedValueService.getValueForSlot(computedSlot);
323
316
  }
324
317
 
325
318
  // src/useOIMComputedCollection.ts