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 =
|
||||
!!openedVersionStatus &&
|
||||
openedVersionStatus.version.id !== options.version.id;
|
||||
const isComingBackToLatestVersionAfterNavigating =
|
||||
!!openedVersionStatus &&
|
||||
latestVersion &&
|
||||
latestVersion.id === options.version.id;
|
||||
|
||||
return [
|
||||
{
|
||||
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: () => {
|
||||
onCheckoutVersion(options.version);
|
||||
},
|
||||
|
@@ -284,11 +284,9 @@ const useVersionHistory = ({
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (
|
||||
checkedOutVersionStatus &&
|
||||
checkedOutVersionStatus.version.id === latestVersionId
|
||||
) {
|
||||
if (checkedOutVersionStatus && version.id === latestVersionId) {
|
||||
await onQuitVersionHistory();
|
||||
setVersionHistoryPanelOpen(false);
|
||||
return;
|
||||
}
|
||||
preventEffectsRunningRef.current = true;
|
||||
|
@@ -158,15 +158,20 @@ export const Default = () => {
|
||||
const projectServiceMock = new MockAdapter(projectApiAxiosClient, {
|
||||
delayResponse: 1000,
|
||||
});
|
||||
const latestVersion = versions[0];
|
||||
|
||||
const onCheckoutVersion = React.useCallback(
|
||||
async (version: FilledCloudProjectVersion) => {
|
||||
if (version.id === latestVersion.id) {
|
||||
setOpenedVersionStatus(null);
|
||||
return;
|
||||
}
|
||||
setOpenedVersionStatus({
|
||||
version,
|
||||
status: 'opened',
|
||||
});
|
||||
},
|
||||
[]
|
||||
[latestVersion.id]
|
||||
);
|
||||
|
||||
const onSaveCurrentlyOpenedVersion = React.useCallback(
|
||||
|
Reference in New Issue
Block a user