Skip to content

Draft: POC for "Redesign Web IDE state management of files and file changes"

Paul Slaughter requested to merge 216180-redesign-state-poc into master

DO NOT MERGE

This MR is a POC for #216180 (closed)

🎉 This POC uses about 1/3 the amount of memory when running the IDE for the gitlab project Screen_Shot_2020-06-15_at_2.41.36_AM
🎉 Calculating incremental diffs is incredibly efficient (~30ms) Screen_Shot_2020-06-15_at_4.35.10_AM
🔍 fileSystem keeps track of files in a normalized way + manages a modified timestamp for files and directories Screen_Shot_2020-06-15_at_4.41.21_AM
🔍 git keeps track of git objects and powers the source control of the IDE. Similar to git, objects are stored based on their hash, therefore duplicated hashes are not stored twice (see the isLoaded: false, content: '' record). Screen_Shot_2020-06-15_at_4.43.46_AM
🔍 git keeps track of the root objects through refs. Screen_Shot_2020-06-15_at_4.45.48_AM
🔍 editor module keeps track of file editor meta data. This is really helpful pulling into a separate object since not every file in the filesystem will be opened. Screen_Shot_2020-06-15_at_4.56.44_AM

POC Issues

  • Adding files isn't implemented yet (but should be really easy)
  • Some components start complaining on load because they are coupled to certain file properties which are no longer used.
  • Increase scope of editor module to replace functionality that no longer exists on the file object itself.

Iteration steps

Here are some steps we can take in parallel to help set up the code to adopt this state management pattern:

  • Update state.tree (and other .tree) to contain references to children (i.e. { type, name }) and not the whole object repeated.
  • Decouple editor and editor properties from the file object (i.e. openFiles, loading, editorRow, editorColumn).
  • Update state.stagedFiles to not duplicate file object and look more like { path, modification }
  • Normalize file.name with file.path.
  • Remove need for file.url with a goToFileUrl action.
  • Remove multi-project abstraction.
  • Normalize file.active into state.activeFilePath
  • Sort tree children by default.

Potential iteration steps:

  • Make state.stagedFiles reactive.
  • Remove trees and just use entries with a root entry.
Edited by Roman Kuba

Merge request reports