Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

file tree: open relevant folders on nav #233

Merged
merged 3 commits into from
Dec 8, 2022
Merged

file tree: open relevant folders on nav #233

merged 3 commits into from
Dec 8, 2022

Conversation

Wattenberger
Copy link
Contributor

This involves preserving the existing open state (don't want to close folders that are already open as the user navigates) and fixing some timing / dependency bugs to make sure the nav scrolls to the newly open file (eg. if clicked to in the minimap).

I also upgraded us to react-vtree to v3 for perf & a cleaner API - it's been in beta since 2020 😅 and is purportedly (and in testing) stable enough to use Lodin/react-vtree#83

includes: upgrade react-vtree to v3
@mattrothenberg
Copy link
Contributor

Tested locally on my end and seems to be working just fine! No problems with the minimap.

Copy link
Contributor

@mattrothenberg mattrothenberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

Copy link
Contributor

@jaked jaked left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 165 to 169
filteredFiles,
updatedContents,
numberOfFiles < 20,
activeFilePath,
query,
query.branchPath.join("/"),
branchName,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to keep the dependencies on activeFilePath and query since they're referenced in getNodeData. or maybe just drop the useMemo, it's not accomplishing anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, what am I missing here:

  • the query.branchPath.join("/"), dep should cover active path changes, right?
  • and the memo is definitely not crucial, but should help a bit with perf. mayhaps it's not worth the extra overhead!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh hm you are right about query.branchPath.join("/") covering activePath, I didn't think that through.

I think this might be one of those cases where the memoized thing is inexpensive so the cost of memoization is nearly the same — I think it's worth dropping these generally because it's so easy to create inadvertent update bugs by leaving off a dependency, but no strong feeling about this one in particular, I'm gappy either way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's fair! I'll remove it to keep the code nice and goncise

Copy link
Contributor

@jaked jaked left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still

@Wattenberger Wattenberger merged commit aa75b6b into main Dec 8, 2022
@Wattenberger Wattenberger deleted the aw/file-tree branch December 8, 2022 21:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants