MCPcopy
hub / github.com/tinyplex/tinybase / useUndoInformation

Function useUndoInformation

src/ui-solid/primitives.ts:1870–1885  ·  view source on GitHub ↗
(
  checkpointsOrCheckpointsId?: MaybeCheckpointsOrCheckpointsId,
)

Source from the content-addressed store, hash-verified

1868};
1869
1870export const useUndoInformation = (
1871 checkpointsOrCheckpointsId?: MaybeCheckpointsOrCheckpointsId,
1872): UndoOrRedoInformation => {
1873 const checkpoints = useCheckpointsOrCheckpointsById(
1874 checkpointsOrCheckpointsId,
1875 );
1876 const [backwardIds, currentId] = getThing(useCheckpointIds(checkpoints));
1877 return [
1878 !arrayIsEmpty(backwardIds),
1879 useGoBackwardCallback(checkpoints),
1880 currentId,
1881 ifNotUndefined(currentId, (id) =>
1882 getThing(checkpoints)?.getCheckpoint(id),
1883 ) ?? EMPTY_STRING,
1884 ];
1885};
1886
1887export const useRedoInformation = (
1888 checkpointsOrCheckpointsId?: MaybeCheckpointsOrCheckpointsId,

Callers 2

CheckpointInfoFunction · 0.90
primitives.test.tsFile · 0.90

Calls 6

arrayIsEmptyFunction · 0.90
getThingFunction · 0.70
useCheckpointIdsFunction · 0.70
useGoBackwardCallbackFunction · 0.70
getCheckpointMethod · 0.65

Tested by 1

CheckpointInfoFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…