Skip to content

Commit

Permalink
Improve naming
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreSi committed Aug 7, 2023
1 parent 8831695 commit eece610
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ const useEditorTabsStateSaving = ({
]
);

const hasARecordForEditorTabs = React.useCallback(
const hasAPreviousSaveForEditorTabsState = React.useCallback(
(project: gdProject) => {
const projectId = project.getProjectUuid();
return !!getEditorStateForProject(projectId);
},
[getEditorStateForProject]
);

const openEditorsAccordingToPersistedState = React.useCallback(
const openEditorTabsFromPersistedState = React.useCallback(
(project: gdProject) => {
const projectId = project.getProjectUuid();
const editorState = getEditorStateForProject(projectId);
Expand Down Expand Up @@ -177,8 +177,8 @@ const useEditorTabsStateSaving = ({
);

return {
hasARecordForEditorTabs,
openEditorsAccordingToPersistedState,
hasAPreviousSaveForEditorTabsState,
openEditorTabsFromPersistedState,
};
};

Expand Down
23 changes: 13 additions & 10 deletions newIDE/app/src/MainFrame/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -646,8 +646,8 @@ const MainFrame = (props: Props) => {
);

const {
hasARecordForEditorTabs,
openEditorsAccordingToPersistedState,
hasAPreviousSaveForEditorTabsState,
openEditorTabsFromPersistedState,
} = useEditorTabsStateSaving({
currentProjectId: state.currentProject
? state.currentProject.getProjectUuid()
Expand Down Expand Up @@ -2010,8 +2010,11 @@ const MainFrame = (props: Props) => {
return openFromFileMetadata(fileMetadata).then(state => {
if (state) {
const { currentProject } = state;
if (currentProject && hasARecordForEditorTabs(currentProject)) {
openEditorsAccordingToPersistedState(currentProject);
if (
currentProject &&
hasAPreviousSaveForEditorTabsState(currentProject)
) {
openEditorTabsFromPersistedState(currentProject);
setIsLoadingProject(false);
setLoaderModalProgress(null, null);
openProjectManager(false);
Expand Down Expand Up @@ -2044,8 +2047,8 @@ const MainFrame = (props: Props) => {
},
[
i18n,
hasARecordForEditorTabs,
openEditorsAccordingToPersistedState,
hasAPreviousSaveForEditorTabsState,
openEditorTabsFromPersistedState,
getStorageProviderOperations,
openFromFileMetadata,
openSceneOrProjectManager,
Expand Down Expand Up @@ -2090,9 +2093,9 @@ const MainFrame = (props: Props) => {
});
} else if (
currentProject &&
hasARecordForEditorTabs(currentProject)
hasAPreviousSaveForEditorTabsState(currentProject)
) {
openEditorsAccordingToPersistedState(currentProject);
openEditorTabsFromPersistedState(currentProject);
setIsLoadingProject(false);
setLoaderModalProgress(null, null);
openProjectManager(false);
Expand Down Expand Up @@ -2122,8 +2125,8 @@ const MainFrame = (props: Props) => {
getStorageProvider,
setHasProjectOpened,
openAllScenes,
hasARecordForEditorTabs,
openEditorsAccordingToPersistedState,
hasAPreviousSaveForEditorTabsState,
openEditorTabsFromPersistedState,
]
);

Expand Down

0 comments on commit eece610

Please sign in to comment.