-
Notifications
You must be signed in to change notification settings - Fork 110
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
feat: allow passing instantiated Vuex store #232
feat: allow passing instantiated Vuex store #232
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Sorry for the late response, busy weeks. Merging this one once CI passes :)
Looks like there are some typing issues – probably due to the extended type for the |
549c028
to
1159003
Compare
04b47b4
to
beddb67
Compare
Thanks @afontcu - I updated this PR and tested it on my fork. I'm a little surprised that |
@@ -127,6 +128,30 @@ export function testConfigCallback() { | |||
}) | |||
} | |||
|
|||
export function testInstantiatedStore() { | |||
render(SomeComponent, { | |||
store: new Vuex.Store({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this test to ensure that a Store
could be provided as StoreOptions<S>
and it looks like it works!
Codecov Report
@@ Coverage Diff @@
## master #232 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 3 3
Lines 99 99
Branches 33 33
=========================================
Hits 99 99
Continue to review full report at Codecov.
|
Thank you for this! 🎉 |
🎉 This PR is included in version 5.7.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 6.6.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
As currently written, the
store
property passed to therender
function must beStoreOptions
, which is a plain Javascript object passed tonew Vuex.Store()
in the render function.This is great for simple components and should definitely still be a supported option. However, it would be really useful for us to be able to pass a complex, instantiated Vuex store (generated by our common test helpers) as well.
This PR accomplishes this behavior by checking if the passed
store
is aninstance of Vuex.Store
and skipping thenew Vuex.Store()
call in that case.If this seems reasonable, I can also update the API documentation in the other repository 😄 . Thanks for your time & consideration!