Skip to content

add filtering for Vuex state #418

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

Merged
merged 10 commits into from
Jan 12, 2018
Merged

add filtering for Vuex state #418

merged 10 commits into from
Jan 12, 2018

Conversation

bartlomieju
Copy link
Contributor

Another simple PR that is really helpful, being able to filter out Vuex state. Closes #401

'inspectedState'
]),
filteredState() {
const filtered = {};
Copy link
Member

Choose a reason for hiding this comment

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

What do you think about reusing what is in ComponentStateInspector? So we just need to build the array of properties before filtering them:

const inspectedState = [].concat(
        ...Object.keys(this.inspectedState).map(
          type => Object.keys(this.inspectedState[type]).map(
            key => ({
              key,
              type,
              value: this.inspectedState[type][key]
            })
          )
        )
      )

      return groupBy(sortByKey(inspectedState.filter(el => {
        return searchDeepInObject({
          [el.key]: el.value
        }, this.filter)
      })), 'type')

It would probably be nice to refactor the last part in the future so it's reused

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, I'll do it first thing when I have some spare time.

Copy link
Member

Choose a reason for hiding this comment

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

Don't worry, I can add it myself as well. Thanks a lot for taking the time to contribute to the devtools! 😄

@bartlomieju
Copy link
Contributor Author

@posva I've actually used your snippet - works perfectly

@yyx990803
Copy link
Member

@posva have you tried this locally?

@posva
Copy link
Member

posva commented Nov 7, 2017

@yyx990803 Not yet, let me give it a shot

@posva
Copy link
Member

posva commented Nov 7, 2017

Tested and works nicely, ofc, it would be better with a test 😄 , I'll add it

@posva
Copy link
Member

posva commented Nov 7, 2017

hhm, got some tests failing. I see we haven't turned on ci on prs but I cannot see the project on circle ci either 😅

@Akryum
Copy link
Member

Akryum commented Dec 23, 2017

Tested and working fine 👍

@posva
Copy link
Member

posva commented Dec 31, 2017

Thanks for picking up @Akryum !

@michalsnik michalsnik added this to the 🎄Holiday Update milestone Jan 3, 2018
@Akryum Akryum mentioned this pull request Jan 4, 2018
@yyx990803 yyx990803 merged commit f40c6cf into vuejs:master Jan 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants