Fix black screen after migrating with release notes (#4825)

This commit is contained in:
WithoutPants 2024-05-10 16:42:33 +10:00 committed by GitHub
parent 77ee620877
commit 12af7d6515
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 6 deletions

View file

@ -277,7 +277,7 @@ export const App: React.FC = () => {
status === GQL.SystemStatusEnum.NeedsMigration status === GQL.SystemStatusEnum.NeedsMigration
) { ) {
// redirect to migrate page // redirect to migrate page
history.push("/migrate"); history.replace("/migrate");
} }
}, [systemStatusData, setupMatch, history, location]); }, [systemStatusData, setupMatch, history, location]);

View file

@ -7,12 +7,13 @@ import {
useSystemStatus, useSystemStatus,
mutateMigrate, mutateMigrate,
postMigrate, postMigrate,
refetchSystemStatus,
} from "src/core/StashService"; } from "src/core/StashService";
import { migrationNotes } from "src/docs/en/MigrationNotes"; import { migrationNotes } from "src/docs/en/MigrationNotes";
import { ExternalLink } from "../Shared/ExternalLink"; import { ExternalLink } from "../Shared/ExternalLink";
import { LoadingIndicator } from "../Shared/LoadingIndicator"; import { LoadingIndicator } from "../Shared/LoadingIndicator";
import { MarkdownPage } from "../Shared/MarkdownPage"; import { MarkdownPage } from "../Shared/MarkdownPage";
import { useMonitorJob } from "src/utils/job"; import { JobFragment, useMonitorJob } from "src/utils/job";
export const Migrate: React.FC = () => { export const Migrate: React.FC = () => {
const intl = useIntl(); const intl = useIntl();
@ -26,7 +27,7 @@ export const Migrate: React.FC = () => {
const [jobID, setJobID] = useState<string | undefined>(); const [jobID, setJobID] = useState<string | undefined>();
const { job } = useMonitorJob(jobID, (finishedJob) => { function onJobFinished(finishedJob?: JobFragment) {
setJobID(undefined); setJobID(undefined);
setMigrateLoading(false); setMigrateLoading(false);
@ -34,9 +35,12 @@ export const Migrate: React.FC = () => {
setMigrateError(finishedJob.error); setMigrateError(finishedJob.error);
} else { } else {
postMigrate(); postMigrate();
history.push("/"); // refetch the system status so that the we get redirected
refetchSystemStatus();
} }
}); }
const { job } = useMonitorJob(jobID, onJobFinished);
// if database path includes path separators, then this is passed through // if database path includes path separators, then this is passed through
// to the migration path. Extract the base name of the database file. // to the migration path. Extract the base name of the database file.
@ -147,7 +151,7 @@ export const Migrate: React.FC = () => {
systemStatus.systemStatus.status !== GQL.SystemStatusEnum.NeedsMigration systemStatus.systemStatus.status !== GQL.SystemStatusEnum.NeedsMigration
) { ) {
// redirect to main page // redirect to main page
history.push("/"); history.replace("/");
return <LoadingIndicator />; return <LoadingIndicator />;
} }

View file

@ -2229,6 +2229,11 @@ export const queryLogs = () =>
}); });
export const useSystemStatus = () => GQL.useSystemStatusQuery(); export const useSystemStatus = () => GQL.useSystemStatusQuery();
export const refetchSystemStatus = () => {
client.refetchQueries({
include: [GQL.SystemStatusDocument],
});
};
export const useJobsSubscribe = () => GQL.useJobsSubscribeSubscription(); export const useJobsSubscribe = () => GQL.useJobsSubscribeSubscription();