( thingOrThingId: MaybeAccessor<UsedThing | Id | undefined>, offset: Offsets, )
| 113 | }; |
| 114 | |
| 115 | export const useThingOrThingById = < |
| 116 | UsedThing extends |
| 117 | | Store |
| 118 | | Metrics |
| 119 | | Indexes |
| 120 | | Relationships |
| 121 | | Queries |
| 122 | | Checkpoints |
| 123 | | AnyPersister |
| 124 | | Synchronizer, |
| 125 | >( |
| 126 | thingOrThingId: MaybeAccessor<UsedThing | Id | undefined>, |
| 127 | offset: Offsets, |
| 128 | ): Accessor<UsedThing | undefined> => { |
| 129 | const thing = useThing(thingOrThingId as MaybeAccessor<Id>, offset); |
| 130 | return () => { |
| 131 | const resolvedThingOrThingId = getValue(thingOrThingId); |
| 132 | return isUndefined(resolvedThingOrThingId) || |
| 133 | isString(resolvedThingOrThingId) |
| 134 | ? (thing() as UsedThing | undefined) |
| 135 | : (resolvedThingOrThingId as UsedThing); |
| 136 | }; |
| 137 | }; |
| 138 | |
| 139 | export const useProvideThing = <Offset extends Offsets>( |
| 140 | thingId: Id, |
no test coverage detected
searching dependent graphs…