Spaces:
Configuration error
Configuration error
Download frontend/src/state/file-state-slice.ts from flyingdarkdev/README: direct link, hf CLI and curl.
- Browser
- Download file 589 Bytes
-
https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/frontend/src/state/file-state-slice.ts
- Command line
-
hf download hf://spaces/flyingdarkdev/README/frontend/src/state/file-state-slice.ts
-
curl -L -o file-state-slice.ts https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/frontend/src/state/file-state-slice.ts
589 Bytes
| import { createSlice, PayloadAction } from "@reduxjs/toolkit"; | |
| type SliceState = { changed: Record<string, boolean> }; // Map<path, changed> | |
| const initialState: SliceState = { | |
| changed: {}, | |
| }; | |
| export const fileStateSlice = createSlice({ | |
| name: "fileState", | |
| initialState, | |
| reducers: { | |
| setChanged( | |
| state, | |
| action: PayloadAction<{ path: string; changed: boolean }>, | |
| ) { | |
| const { path, changed } = action.payload; | |
| state.changed[path] = changed; | |
| }, | |
| }, | |
| }); | |
| export const { setChanged } = fileStateSlice.actions; | |
| export default fileStateSlice.reducer; | |