Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix namespace picker so that it always expands into an object when co… #7333

Merged
merged 3 commits into from
Aug 22, 2019

Conversation

meirish
Copy link
Contributor

@meirish meirish commented Aug 19, 2019

…nstructing a tree

Previously, if you had a nested namespace that was a number, it would get expanded by the unflatten method from flat as an array, so if you had a namespace named foo/999999, foo would be an array with 999999 members. This caused a pretty rough lag in the ui, but also resulted in incorrect links.

The fix was to use unflatten with the object:true option. I also added a test for this particular case that failed without the code change:
Screen Shot 2019-08-19 at 1 13 36 PM

While I was in the area, I also sorted the namespaces which closes #7339

@meirish meirish added ui bug Used to indicate a potential bug labels Aug 19, 2019
@meirish meirish added this to the 1.2.3 milestone Aug 19, 2019
@meirish meirish requested a review from a team August 19, 2019 18:19
@meirish meirish force-pushed the ui-namespace-nested-numbers branch from b54c6a1 to 6a45c4b Compare August 20, 2019 19:05
madalynrose
madalynrose previously approved these changes Aug 22, 2019
// after the reduction we're left with an array that contains
// strings that represent the longest branches
// we'll replace the dots in the paths, then expand the path
// to a nested object that we can then query with Ember.get
return deepmerge.all(
tree.map(p => {
p = p.replace(/\.+/g, DOT_REPLACEMENT);
return unflatten({ [p]: null }, { delimiter: '/' });
return unflatten({ [p]: null }, { delimiter: '/', object: true });
Copy link
Contributor

Choose a reason for hiding this comment

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

wow this is a really simple fix! nice!

@meirish
Copy link
Contributor Author

meirish commented Aug 22, 2019

Thanks for the review! Going to merge, the last commit was just fixing linting and rebasing (so it dismissed the review).

@meirish meirish merged commit b241b2d into master Aug 22, 2019
@meirish meirish deleted the ui-namespace-nested-numbers branch August 22, 2019 19:00
meirish added a commit that referenced this pull request Aug 22, 2019
#7333)

* fix namespace picker so that it always expands into an object when constructing a tree

* sort namespaces lexicographically

* fix linting
meirish added a commit that referenced this pull request Aug 22, 2019
#7333) (#7352)

* fix namespace picker so that it always expands into an object when constructing a tree

* sort namespaces lexicographically

* fix linting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Used to indicate a potential bug ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI: Sort namespace picker alphabetically
3 participants