Skip to content

Fix Directory error and refactor file list

Loic Huder requested to merge fix-directory into master

Again, lots of diffs.

The list of directories (which were in fact file nodes, more on this below) were stored into a Map<number, Directory[]> while it was used as Map<number, Directory> as pointed out by Axel in !12 (merged).

It wasn't caught by TS because Object.entries of a Map object is cast to any (🤷). I solved this by using a Directory[] instead of a Map which fixes the typing and removes the need for Object.entries.

I also refactored the file list components:

  • Directory was renamed to FileNode as it can represent a directory or a file. Related methods (such as listDirectory) were renamed as well
  • data attributes of the file node button were removed. They were used in the handleOnClick function to determine the file name and type but this was replaced by a function navigateTo that is dynamically set as prop.
  • renderPathTooltip and iconFromType were extracted in separate components
Edited by Loic Huder

Merge request reports