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
) {
// redirect to migrate page
history.push("/migrate");
history.replace("/migrate");
}
}, [systemStatusData, setupMatch, history, location]);

View File

@ -7,12 +7,13 @@ import {
useSystemStatus,
mutateMigrate,
postMigrate,
refetchSystemStatus,
} from "src/core/StashService";
import { migrationNotes } from "src/docs/en/MigrationNotes";
import { ExternalLink } from "../Shared/ExternalLink";
import { LoadingIndicator } from "../Shared/LoadingIndicator";
import { MarkdownPage } from "../Shared/MarkdownPage";
import { useMonitorJob } from "src/utils/job";
import { JobFragment, useMonitorJob } from "src/utils/job";
export const Migrate: React.FC = () => {
const intl = useIntl();
@ -26,7 +27,7 @@ export const Migrate: React.FC = () => {
const [jobID, setJobID] = useState<string | undefined>();
const { job } = useMonitorJob(jobID, (finishedJob) => {
function onJobFinished(finishedJob?: JobFragment) {
setJobID(undefined);
setMigrateLoading(false);
@ -34,9 +35,12 @@ export const Migrate: React.FC = () => {
setMigrateError(finishedJob.error);
} else {
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
// 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
) {
// redirect to main page
history.push("/");
history.replace("/");
return <LoadingIndicator />;
}

View File

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