({
store,
storesById,
metrics,
metricsById,
indexes,
indexesById,
relationships,
relationshipsById,
queries,
queriesById,
checkpoints,
checkpointsById,
persister,
persistersById,
synchronizer,
synchronizersById,
children,
}: ProviderProps & {readonly children: ReactNode})
| 46 | ]; |
| 47 | |
| 48 | export const Provider: typeof ProviderDecl = ({ |
| 49 | store, |
| 50 | storesById, |
| 51 | metrics, |
| 52 | metricsById, |
| 53 | indexes, |
| 54 | indexesById, |
| 55 | relationships, |
| 56 | relationshipsById, |
| 57 | queries, |
| 58 | queriesById, |
| 59 | checkpoints, |
| 60 | checkpointsById, |
| 61 | persister, |
| 62 | persistersById, |
| 63 | synchronizer, |
| 64 | synchronizersById, |
| 65 | children, |
| 66 | }: ProviderProps & {readonly children: ReactNode}): any => { |
| 67 | const parentValue = useContext(Context); |
| 68 | const [extraThingsById, setExtraThingsById] = useState<ExtraThingsById>( |
| 69 | () => arrayNew(8, () => ({})) as ExtraThingsById, |
| 70 | ); |
| 71 | const addExtraThingById = useCallback( |
| 72 | <Offset extends Offsets>( |
| 73 | thingOffset: Offset, |
| 74 | id: Id, |
| 75 | thing: ThingsByOffset[Offset], |
| 76 | ) => |
| 77 | setExtraThingsById((extraThingsById) => |
| 78 | objGet(extraThingsById[thingOffset] as any, id) == thing |
| 79 | ? extraThingsById |
| 80 | : (arrayWith(extraThingsById, thingOffset, { |
| 81 | ...extraThingsById[thingOffset], |
| 82 | [id]: thing, |
| 83 | } as any) as ExtraThingsById), |
| 84 | ), |
| 85 | [], |
| 86 | ); |
| 87 | |
| 88 | const delExtraThingById = useCallback( |
| 89 | (thingOffset: Offsets, id: Id) => |
| 90 | setExtraThingsById((extraThingsById) => |
| 91 | !objHas(extraThingsById[thingOffset], id) |
| 92 | ? extraThingsById |
| 93 | : (arrayWith( |
| 94 | extraThingsById, |
| 95 | thingOffset, |
| 96 | objDel(extraThingsById[thingOffset] as any, id), |
| 97 | ) as ExtraThingsById), |
| 98 | ), |
| 99 | [], |
| 100 | ); |
| 101 | |
| 102 | return ( |
| 103 | <Context.Provider |
| 104 | value={useMemo( |
| 105 | () => [ |
nothing calls this directly
no test coverage detected
searching dependent graphs…