Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

vcs.ts

27 lines972 Bytes

1import {
2 createVcsActionManager,
3 createVcsEnvironmentAtoms,
4 createVcsStatusRevalidationAtomFamily,
5} from "@t3tools/client-runtime/state/vcs";
6​
7import { connectionAtomRuntime } from "../connection/runtime";
8import { subscribeDocumentReturn } from "../lib/documentActivity";
9​
10export const vcsEnvironment = createVcsEnvironmentAtoms(connectionAtomRuntime);
11export const vcsActionManager = createVcsActionManager(connectionAtomRuntime);
12​
13/**
14 * Refreshes a checkout's status when the user comes back to the window, where
15 * edits made in another app or terminal may be waiting.
16 */
17export const vcsStatusRevalidation = createVcsStatusRevalidationAtomFamily({
18 refreshStatus: vcsEnvironment.refreshStatus,
19 subscribeWake: subscribeDocumentReturn,
20 wakeDebounceMs: 250,
21});
22​
23export const vcsBranchRevalidation = createVcsStatusRevalidationAtomFamily({
24 refreshStatus: vcsEnvironment.refreshBranch,
25 subscribeWake: subscribeDocumentReturn,
26 wakeDebounceMs: 250,
27});