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

Set expanded stores to objects instead of arrays #6290

Merged
merged 1 commit into from
Mar 26, 2019
Merged

Set expanded stores to objects instead of arrays #6290

merged 1 commit into from
Mar 26, 2019

Conversation

dougmacknz
Copy link
Contributor

Issue: #6210

What I did

Fixed the setting of unfilteredExpanded & filteredExpanded to objects instead of arrays (I'm assuming these were meant to be objects).

The bug was happening on treeview.js:153. unfilteredExpanded[key] was being stored as the value. This usually returns a bool if the key exists in the array, but when you run this with an array function name it returns the function itself 😮 😆
image

How to test

  • Change line 5 in examples/cra-kitchen-sink/src/stories/Lifecycle.stories.js to
storiesOf('Map', module).add('logging', () => <LifecycleLogger />);`
cd examples/cra-kitchen-sink
yarn storybook --no-dll
  • Open console in your browser.

Alternatively I also coded a solution which refactored these stores of expanded items into arrays of sidebar item id's and checked indexOf(), instead of using a key-value relationship. This was before I realised these were probably just meant to be objects. If you'd prefer that solution I can push that up.

@shilman shilman added bug ui patch:yes Bugfix & documentation PR that need to be picked to main branch labels Mar 26, 2019
@shilman shilman added this to the 5.0.x milestone Mar 26, 2019
@codecov
Copy link

codecov bot commented Mar 26, 2019

Codecov Report

Merging #6290 into next will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             next    #6290   +/-   ##
=======================================
  Coverage   38.29%   38.29%           
=======================================
  Files         648      648           
  Lines        9839     9839           
  Branches      387      387           
=======================================
  Hits         3768     3768           
  Misses       6011     6011           
  Partials       60       60
Impacted Files Coverage Δ
lib/ui/src/components/sidebar/treeview/treeview.js 57.14% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9937954...ff4d3f3. Read the comment docs.

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

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

Good one! 🤕

@shilman shilman merged commit 0fb9047 into storybookjs:next Mar 26, 2019
@shilman shilman added the patch:done Patch/release PRs already cherry-picked to main/release branch label Apr 1, 2019
shilman added a commit that referenced this pull request Apr 1, 2019
Set expanded stores to objects instead of arrays
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug patch:done Patch/release PRs already cherry-picked to main/release branch patch:yes Bugfix & documentation PR that need to be picked to main branch ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants