Repository: 4ian/GDevelop
File: newIDE/app/src/MainFrame/index.js (JavaScript)

Code before:
      }));
    },
    ensureResourcesAreMoved,
    onGameRegistered: gamesList.fetchGames,
  });

  const {
    onSelectExampleShortHeader,
    onSelectPrivateGameTemplateListingData,
    renderNewProjectDialog,
    fetchAndOpenNewProjectSetupDialogForExample,
    openNewProjectDialog,
  } = useNewProjectDialog({
    isProjectOpening,
    newProjectSetupDialogOpen,
    setNewProjectSetupDialogOpen,
    createEmptyProject,
    createProjectFromExample,
    createProjectFromPrivateGameTemplate,
    createProjectFromAIGeneration,
    storageProviders: props.storageProviders,
  });

  const gamesPlatformFrameTools = UseGamesPlatformFrame({
    fetchAndOpenNewProjectSetupDialogForExample,
    onOpenProfileDialog: () => openProfileDialog(true),
  });

  const closeApp = React.useCallback((): void => {
    return Window.quit();
  }, []);

  const toggleProjectManager = React.useCallback(
    () => {
      if (toolbar.current)
        openProjectManager(projectManagerOpen => !projectManagerOpen);
    },
    [openProjectManager]
  );

  const setEditorToolbar = (editorToolbar: any, isCurrentTab = true) => {
    if (!toolbar.current || !isCurrentTab) return;

    toolbar.current.setEditorToolbar(editorToolbar);
  };

  const onInstallExtension = (extensionShortHeader: ExtensionShortHeader) => {
    const { currentProject } = state;
    if (!currentProject) return;

    // Close the extension tab before updating/reinstalling the extension.

Review comment (suggestion):
useCallback the onOpenProfileDialog, otherwise this means that `handleIframeMessage` is unstable and will be disconnected/reconnected at every single render 😱

This would probably be worth a log in the code doing the `addEventListener` so we can see the console filling with logs if we break the stability in the future.

Code after:
      }));
    },
    ensureResourcesAreMoved,
    onGameRegistered: gamesList.fetchGames,
  });

  const {
    onSelectExampleShortHeader,
    onSelectPrivateGameTemplateListingData,
    renderNewProjectDialog,
    fetchAndOpenNewProjectSetupDialogForExample,
    openNewProjectDialog,
  } = useNewProjectDialog({
    isProjectOpening,
    newProjectSetupDialogOpen,
    setNewProjectSetupDialogOpen,
    createEmptyProject,
    createProjectFromExample,
    createProjectFromPrivateGameTemplate,
    createProjectFromAIGeneration,
    storageProviders: props.storageProviders,
  });

  const onOpenProfileDialog = React.useCallback(
    () => {
      openProfileDialog(true);
    },
    [openProfileDialog]
  );

  const gamesPlatformFrameTools = useGamesPlatformFrame({
    fetchAndOpenNewProjectSetupDialogForExample,
    onOpenProfileDialog,
  });

  const closeApp = React.useCallback((): void => {
    return Window.quit();
  }, []);

  const toggleProjectManager = React.useCallback(
    () => {
      if (toolbar.current)
        openProjectManager(projectManagerOpen => !projectManagerOpen);
    },
    [openProjectManager]
  );

  const setEditorToolbar = (editorToolbar: any, isCurrentTab = true) => {
    if (!toolbar.current || !isCurrentTab) return;

    toolbar.current.setEditorToolbar(editorToolbar);