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

Function useSetCheckpointCallback

src/ui-react/hooks.ts:2197–2222  ·  view source on GitHub ↗
(
  getCheckpoint: (parameter: Parameter) => string | undefined = getUndefined,
  getCheckpointDeps: DependencyList = EMPTY_ARRAY,
  checkpointsOrCheckpointsId?: CheckpointsOrCheckpointsId,
  then: (
    checkpointId: Id,
    checkpoints: Checkpoints,
    label?: string,
  ) => void = getUndefined,
  thenDeps: DependencyList = EMPTY_ARRAY,
)

Source from the content-addressed store, hash-verified

2195 );
2196
2197export const useSetCheckpointCallback: typeof useSetCheckpointCallbackDecl = <
2198 Parameter,
2199>(
2200 getCheckpoint: (parameter: Parameter) => string | undefined = getUndefined,
2201 getCheckpointDeps: DependencyList = EMPTY_ARRAY,
2202 checkpointsOrCheckpointsId?: CheckpointsOrCheckpointsId,
2203 then: (
2204 checkpointId: Id,
2205 checkpoints: Checkpoints,
2206 label?: string,
2207 ) => void = getUndefined,
2208 thenDeps: DependencyList = EMPTY_ARRAY,
2209): ParameterizedCallback<Parameter> => {
2210 const checkpoints = useCheckpointsOrCheckpointsById(
2211 checkpointsOrCheckpointsId,
2212 );
2213 return useCallback(
2214 (parameter) =>
2215 ifNotUndefined(checkpoints, (checkpoints) => {
2216 const label = getCheckpoint(parameter as any);
2217 then(checkpoints.addCheckpoint(label), checkpoints, label);
2218 }),
2219 // eslint-disable-next-line react-hooks/exhaustive-deps
2220 [checkpoints, ...getCheckpointDeps, ...thenDeps],
2221 );
2222};
2223
2224export const useGoBackwardCallback: typeof useGoBackwardCallbackDecl = (
2225 checkpointsOrCheckpointsId?: CheckpointsOrCheckpointsId,

Callers 4

WriterFunction · 0.90
TestFunction · 0.90
CheckpointsFunction · 0.50
CheckpointsFunction · 0.50

Calls 3

addCheckpointMethod · 0.65
getCheckpointFunction · 0.50

Tested by 2

WriterFunction · 0.72
TestFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…