mirror of
https://github.com/pterodactyl/panel.git
synced 2024-11-23 01:22:30 +01:00
Don't re-render entire file list when opening modals
This commit is contained in:
parent
deb61623b2
commit
d86d0fedb4
@ -27,6 +27,7 @@ export default () => {
|
|||||||
const id = ServerContext.useStoreState(state => state.server.data!.id);
|
const id = ServerContext.useStoreState(state => state.server.data!.id);
|
||||||
const { hash } = useLocation();
|
const { hash } = useLocation();
|
||||||
const { data: files, error, mutate } = useFileManagerSwr();
|
const { data: files, error, mutate } = useFileManagerSwr();
|
||||||
|
const directory = ServerContext.useStoreState(state => state.files.directory);
|
||||||
const clearFlashes = useStoreActions(actions => actions.flashes.clearFlashes);
|
const clearFlashes = useStoreActions(actions => actions.flashes.clearFlashes);
|
||||||
const setDirectory = ServerContext.useStoreActions(actions => actions.files.setDirectory);
|
const setDirectory = ServerContext.useStoreActions(actions => actions.files.setDirectory);
|
||||||
const setSelectedFiles = ServerContext.useStoreActions(actions => actions.files.setSelectedFiles);
|
const setSelectedFiles = ServerContext.useStoreActions(actions => actions.files.setSelectedFiles);
|
||||||
@ -37,6 +38,10 @@ export default () => {
|
|||||||
setDirectory(hash.length > 0 ? hash : '/');
|
setDirectory(hash.length > 0 ? hash : '/');
|
||||||
}, [ hash ]);
|
}, [ hash ]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
mutate();
|
||||||
|
}, [ directory ]);
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
return (
|
return (
|
||||||
<ServerError message={httpErrorToHuman(error)} onRetry={() => mutate()}/>
|
<ServerError message={httpErrorToHuman(error)} onRetry={() => mutate()}/>
|
||||||
|
@ -11,7 +11,8 @@ export default () => {
|
|||||||
`${uuid}:files:${directory}`,
|
`${uuid}:files:${directory}`,
|
||||||
() => loadDirectory(uuid, cleanDirectoryPath(directory)),
|
() => loadDirectory(uuid, cleanDirectoryPath(directory)),
|
||||||
{
|
{
|
||||||
revalidateOnMount: true,
|
focusThrottleInterval: 30000,
|
||||||
|
revalidateOnMount: false,
|
||||||
refreshInterval: 0,
|
refreshInterval: 0,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user