mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Quit navigating history when checking out latest save
This commit is contained in:
@@ -134,6 +134,11 @@ const VersionHistory = React.memo<Props>(
|
|||||||
const isNotTheCurrentlyOpenedVersion =
|
const isNotTheCurrentlyOpenedVersion =
|
||||||
!!openedVersionStatus &&
|
!!openedVersionStatus &&
|
||||||
openedVersionStatus.version.id !== options.version.id;
|
openedVersionStatus.version.id !== options.version.id;
|
||||||
|
const isComingBackToLatestVersionAfterNavigating =
|
||||||
|
!!openedVersionStatus &&
|
||||||
|
latestVersion &&
|
||||||
|
latestVersion.id === options.version.id;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
label: i18n._(
|
label: i18n._(
|
||||||
@@ -144,7 +149,9 @@ const VersionHistory = React.memo<Props>(
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: i18n._(t`Open version`),
|
label: isComingBackToLatestVersionAfterNavigating
|
||||||
|
? i18n._(t`Come back to latest version`)
|
||||||
|
: i18n._(t`Open version`),
|
||||||
click: () => {
|
click: () => {
|
||||||
onCheckoutVersion(options.version);
|
onCheckoutVersion(options.version);
|
||||||
},
|
},
|
||||||
|
@@ -284,11 +284,9 @@ const useVersionHistory = ({
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (
|
if (checkedOutVersionStatus && version.id === latestVersionId) {
|
||||||
checkedOutVersionStatus &&
|
|
||||||
checkedOutVersionStatus.version.id === latestVersionId
|
|
||||||
) {
|
|
||||||
await onQuitVersionHistory();
|
await onQuitVersionHistory();
|
||||||
|
setVersionHistoryPanelOpen(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
preventEffectsRunningRef.current = true;
|
preventEffectsRunningRef.current = true;
|
||||||
|
@@ -158,15 +158,20 @@ export const Default = () => {
|
|||||||
const projectServiceMock = new MockAdapter(projectApiAxiosClient, {
|
const projectServiceMock = new MockAdapter(projectApiAxiosClient, {
|
||||||
delayResponse: 1000,
|
delayResponse: 1000,
|
||||||
});
|
});
|
||||||
|
const latestVersion = versions[0];
|
||||||
|
|
||||||
const onCheckoutVersion = React.useCallback(
|
const onCheckoutVersion = React.useCallback(
|
||||||
async (version: FilledCloudProjectVersion) => {
|
async (version: FilledCloudProjectVersion) => {
|
||||||
|
if (version.id === latestVersion.id) {
|
||||||
|
setOpenedVersionStatus(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
setOpenedVersionStatus({
|
setOpenedVersionStatus({
|
||||||
version,
|
version,
|
||||||
status: 'opened',
|
status: 'opened',
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
[]
|
[latestVersion.id]
|
||||||
);
|
);
|
||||||
|
|
||||||
const onSaveCurrentlyOpenedVersion = React.useCallback(
|
const onSaveCurrentlyOpenedVersion = React.useCallback(
|
||||||
|
Reference in New Issue
Block a user