Skip to content

Commit

Permalink
Remove app argument when opening from url
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementPasteau committed Nov 22, 2024
1 parent 8d87c31 commit ae27abb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion newIDE/app/src/MainFrame/RouterContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ type RouteKey =
| 'games-dashboard-tab'
| 'asset-pack'
| 'game-template'
| 'tutorial-id';
| 'tutorial-id'
| 'create-from-example';
export type RouteArguments = { [RouteKey]: string };

export type Router = {|
Expand Down
7 changes: 6 additions & 1 deletion newIDE/app/src/MainFrame/UseNewProjectDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import NewProjectSetupDialog, {
type NewProjectSetup,
} from '../ProjectCreation/NewProjectSetupDialog';
import { type StorageProvider } from '../ProjectsStorage';
import RouterContext from './RouterContext';

type Props = {|
isProjectOpening: boolean,
Expand Down Expand Up @@ -56,6 +57,7 @@ const useExampleOrGameTemplateDialogs = ({
setSelectedExampleShortHeader,
] = React.useState<?ExampleShortHeader>(null);
const [preventBackHome, setPreventBackHome] = React.useState(true);
const { removeRouteArguments } = React.useContext(RouterContext);

const { receivedGameTemplates } = React.useContext(AuthenticatedUserContext);
const { privateGameTemplateListingDatas } = React.useContext(
Expand Down Expand Up @@ -169,9 +171,12 @@ const useExampleOrGameTemplateDialogs = ({
return;
} finally {
setIsFetchingExample(false);
// Remove any route arguments in case it was opened from the url,
// and so that the example is not opened again.
removeRouteArguments(['create-from-example']);
}
},
[onSelectExampleShortHeader]
[onSelectExampleShortHeader, removeRouteArguments]
);

const renderNewProjectDialog = () => {
Expand Down

0 comments on commit ae27abb

Please sign in to comment.