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

Code before:
        if (!selectedItem) return;
        if (selectedItem.content.isDescendantOf(item.content)) {
          selectObjectFolderOrObjectWithContext(null);
        }
      },
      [selectObjectFolderOrObjectWithContext, selectedItems]
    );

    // Force List component to be mounted again if project or objectsContainer
    // has been changed. Avoid accessing to invalid objects that could
    // crash the app.
    const listKey = project.ptr + ';' + objectsContainer.ptr;
    const initiallyOpenedNodeIds = [
      globalObjectsRootFolder && globalObjectsRootFolder.getChildrenCount() > 0
        ? globalObjectsRootFolderId
        : null,
      sceneObjectsRootFolderId,
    ].filter(Boolean);

    const arrowKeyNavigationProps = React.useMemo(
      () => ({
        onGetItemInside: (item: TreeViewItem): ?TreeViewItem => {
          if (item.isPlaceholder || item.isRoot) return null;
          const objectFolderOrObject = item.content.getObjectFolderOrObject();
          if (!objectFolderOrObject) return null;
          if (!objectFolderOrObject.isFolder()) return null;
          else {
            if (objectFolderOrObject.getChildrenCount() === 0) return null;
            return createTreeViewItem({
              objectFolderOrObject: objectFolderOrObject.getChildAt(0),
              isGlobal: item.content.isGlobal(),
              objectFolderTreeViewItemProps,
              objectTreeViewItemProps,
            });
          }
        },
        onGetItemOutside: (item: TreeViewItem): ?TreeViewItem => {
          if (item.isPlaceholder || item.isRoot) return null;
          const objectFolderOrObject = item.content.getObjectFolderOrObject();
          if (!objectFolderOrObject) return null;
          const parent = objectFolderOrObject.getParent();
          if (parent.isRootFolder()) return null;
          return createTreeViewItem({
            objectFolderOrObject: parent,
            isGlobal: item.content.isGlobal(),
            objectFolderTreeViewItemProps,
            objectTreeViewItemProps,
          });
        },
      }),
      [objectFolderTreeViewItemProps, objectTreeViewItemProps]

Review comment (suggestion):
Removing the column, you removed the margin, you should maybe remove the `noMargin` in the child Column

Code after:
     * does not stay selected and not visible to the user.
     */
    const onCollapseItem = React.useCallback(
      (item: TreeViewItem) => {
        if (!selectedItems || selectedItems.length !== 1) return;
        const selectedItem = selectedItems[0];
        if (!selectedItem) return;
        if (selectedItem.content.isDescendantOf(item.content)) {
          selectObjectFolderOrObjectWithContext(null);
        }
      },
      [selectObjectFolderOrObjectWithContext, selectedItems]
    );

    // Force List component to be mounted again if project or objectsContainer
    // has been changed. Avoid accessing to invalid objects that could
    // crash the app.
    const listKey = project.ptr + ';' + objectsContainer.ptr;
    const initiallyOpenedNodeIds = [
      globalObjectsRootFolder && globalObjectsRootFolder.getChildrenCount() > 0
        ? globalObjectsRootFolderId
        : null,
      sceneObjectsRootFolderId,
    ].filter(Boolean);

    const arrowKeyNavigationProps = React.useMemo(
      () => ({
        onGetItemInside: (item: TreeViewItem): ?TreeViewItem => {
          if (item.isPlaceholder || item.isRoot) return null;
          const objectFolderOrObject = item.content.getObjectFolderOrObject();
          if (!objectFolderOrObject) return null;
          if (!objectFolderOrObject.isFolder()) return null;
          else {
            if (objectFolderOrObject.getChildrenCount() === 0) return null;
            return createTreeViewItem({
              objectFolderOrObject: objectFolderOrObject.getChildAt(0),
              isGlobal: item.content.isGlobal(),
              objectFolderTreeViewItemProps,
              objectTreeViewItemProps,
            });
          }
        },
        onGetItemOutside: (item: TreeViewItem): ?TreeViewItem => {
          if (item.isPlaceholder || item.isRoot) return null;
          const objectFolderOrObject = item.content.getObjectFolderOrObject();
          if (!objectFolderOrObject) return null;
          const parent = objectFolderOrObject.getParent();
          if (parent.isRootFolder()) return null;
          return createTreeViewItem({
            objectFolderOrObject: parent,
            isGlobal: item.content.isGlobal(),