42 sidebar folder tree - #72
Conversation
jeswr
left a comment
There was a problem hiding this comment.
Rather than caching just within the FolderTree component; we should be globally caching responses. This will prevent needing to re-fetch container contents between the sidebar view and the main file/folder view.
Long term we should migrate to something like https://github.com/jeswr/solid-sdk/tree/main/packages/solid-offline
|
Preview deployment: https://solid-file-manager-7prl0e6s7-solid-odis-projects.vercel.app |
| const closeRenameDialog = useCallback(() => { | ||
| setShowRenameDialog(false); | ||
| setFileToRename(null); | ||
| }, []); | ||
|
|
||
| const closePreviewModal = useCallback(() => { | ||
| setShowPreviewModal(false); | ||
| setFileToPreview(null); | ||
| }, []); | ||
|
|
||
| const closeMoveDialog = useCallback(() => { | ||
| setShowMoveDialog(false); | ||
| setFileToMove(null); | ||
| }, []); | ||
|
|
||
| const closeDeleteDialog = useCallback(() => { | ||
| setShowDeleteDialog(false); | ||
| setFileToDelete(null); | ||
| }, []); | ||
|
|
||
| const closeShareDialog = useCallback(() => { | ||
| setShowShareDialog(false); | ||
| setFileToShare(null); | ||
| }, []); |
There was a problem hiding this comment.
Rather than having all of these states; could have something like:
const [aciton, setAction] = useState<undefined | { file: string, action: 'share' | 'delete' | 'move' ... }>(undefined)
and manage this in a single state
| const headers = new Headers(init?.headers); | ||
| headers.set( | ||
| "Cache-Control", | ||
| "no-cache, no-store, must-revalidate", | ||
| ); | ||
| headers.set("Pragma", "no-cache"); | ||
| return fetchFn(input, { | ||
| ...init, | ||
| headers, | ||
| cache: "no-store", | ||
| }); |
There was a problem hiding this comment.
Servers should not be serving caching headers on mutable resources. I suspect we should be able to remove this code entirely. Please open an issue for this.
This PR addresses #42