MCPcopy Index your code
hub / github.com/tinyplex/tinybase / useGoToCallback

Function useGoToCallback

src/ui-solid/primitives.ts:1852–1868  ·  view source on GitHub ↗
(
  getCheckpointId: (parameter: Parameter) => Id,
  checkpointsOrCheckpointsId?: MaybeCheckpointsOrCheckpointsId,
  then: (checkpoints: Checkpoints, checkpointId: Id) => void = getUndefined,
)

Source from the content-addressed store, hash-verified

1850): Callback => useCheckpointAction(checkpointsOrCheckpointsId, 'goForward');
1851
1852export const useGoToCallback = <Parameter>(
1853 getCheckpointId: (parameter: Parameter) => Id,
1854 checkpointsOrCheckpointsId?: MaybeCheckpointsOrCheckpointsId,
1855 then: (checkpoints: Checkpoints, checkpointId: Id) => void = getUndefined,
1856): ParameterizedCallback<Parameter> => {
1857 const checkpoints = useCheckpointsOrCheckpointsById(
1858 checkpointsOrCheckpointsId,
1859 );
1860 return (parameter) =>
1861 ifNotUndefined(getThing(checkpoints), (resolvedCheckpoints) =>
1862 ifNotUndefined(
1863 getCheckpointId(parameter as Parameter),
1864 (checkpointId: Id) =>
1865 then(resolvedCheckpoints.goTo(checkpointId), checkpointId),
1866 ),
1867 );
1868};
1869
1870export const useUndoInformation = (
1871 checkpointsOrCheckpointsId?: MaybeCheckpointsOrCheckpointsId,

Callers 1

primitives.test.tsFile · 0.90

Calls 3

getThingFunction · 0.70
goToMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…