Skip to content

Commit 971b030

Browse files
committed
Vuex store 4 support
1 parent 801f20c commit 971b030

File tree

8 files changed

+97
-24
lines changed

8 files changed

+97
-24
lines changed

packages/@posva/vuefire-core/src/firestore/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export function bindCollection(
170170
) {
171171
const options = Object.assign({}, DEFAULT_OPTIONS, extraOptions) // fill default values
172172
// TODO support pathes? nested.obj.list (walkSet)
173-
const array = options.wait ? [] : ops.set(vm, key, [])
173+
const array = vm[key]
174174
const originalResolve = resolve
175175
let isResolved: boolean
176176

packages/@posva/vuefire-test-helpers/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
},
2929
"dependencies": {
3030
"firebase-mock": "^2.2.10",
31-
"vue": "^2.6.11"
31+
"vue": "3.0.7"
3232
},
3333
"gitHead": "e3e2df3624572cec86ed861f2472df4d143f2265"
3434
}

packages/@posva/vuefire-test-helpers/src/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import Vue from 'vue'
1+
import Vue, { nextTick } from 'vue'
22
import { MockFirebase, MockedReference } from 'firebase-mock'
33
import firebase from '../../../../node_modules/firebase/index'
44
import { walkSet } from '@posva/vuefire-core'
55

6-
Vue.config.productionTip = false
7-
Vue.config.devtools = false
86
export { Vue, MockFirebase, MockedReference }
97

108
export * from './mock'
@@ -62,7 +60,7 @@ export function delayUpdate(ref: firebase.firestore.DocumentReference, time = 0)
6260

6361
export function tick() {
6462
return new Promise(resolve => {
65-
Vue.nextTick(resolve)
63+
nextTick(resolve)
6664
})
6765
}
6866

packages/vuexfire/__tests__/firestore.spec.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
import Vuex from 'vuex'
1+
import { createStore } from 'vuex'
22
import { vuexfireMutations, firestoreAction } from '../src'
33
import { db, tick, Vue, delayUpdate } from '@posva/vuefire-test-helpers'
44
import firebase from 'firebase/app'
55
import { FirestoreOptions } from '@posva/vuefire-core/dist/packages/@posva/vuefire-core/src'
66

7-
Vue.use(Vuex)
8-
97
describe('firestoreAction', () => {
108
const item: any = null,
119
items: any[] = []
12-
const store = new Vuex.Store<{ item: any; items: any[] }>({
10+
const store = createStore({
1311
state: { item, items },
1412
mutations: vuexfireMutations,
1513
actions: {

packages/vuexfire/__tests__/options.spec.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
import Vuex from 'vuex'
1+
import { createStore } from 'vuex'
22
import { vuexfireMutations, firestoreAction } from '../src'
33
import { db, tick, Vue } from '@posva/vuefire-test-helpers'
44
import firebase from 'firebase/app'
55
import { FirestoreOptions } from '@posva/vuefire-core/dist/packages/@posva/vuefire-core/src'
66

7-
Vue.use(Vuex)
8-
97
describe('firestoreAction', () => {
108
const item: any = null,
119
items: any[] = []
12-
const store = new Vuex.Store<{ item: any; items: any[] }>({
10+
const store = createStore({
1311
state: { item, items },
1412
mutations: vuexfireMutations,
1513
actions: {

packages/vuexfire/__tests__/rtdb.spec.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
import Vuex from 'vuex'
1+
import { createStore } from 'vuex'
22
import { firebaseAction, vuexfireMutations } from '../src'
33
import { MockFirebase, tick, Vue } from '@posva/vuefire-test-helpers'
44
import firebase from 'firebase/app'
55

66
import { RTDBOptions } from '@posva/vuefire-core/dist/packages/@posva/vuefire-core/src'
77

8-
Vue.use(Vuex)
9-
108
const db = new MockFirebase().child('data')
119

1210
describe('RTDB: firebaseAction', () => {
1311
const item: any = null,
1412
items: any[] = []
15-
const store = new Vuex.Store<{ item: any; items: any[] }>({
13+
const store = createStore({
1614
state: { items, item },
1715
mutations: vuexfireMutations,
1816
actions: {

packages/vuexfire/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"homepage": "https://github.com/vuejs/vuefire#readme",
5353
"devDependencies": {
5454
"@posva/vuefire-test-helpers": "^1.2.3",
55-
"vuex": "^3.1.1"
55+
"vuex": "^4.0.0"
5656
},
5757
"dependencies": {
5858
"@posva/vuefire-core": "^2.3.4"

yarn.lock

Lines changed: 86 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,11 @@
250250
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz#a78c7a7251e01f616512d31b10adcf52ada5e0d2"
251251
integrity sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==
252252

253+
"@babel/helper-validator-identifier@^7.12.11":
254+
version "7.12.11"
255+
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz#c9a1f021917dcb5ccf0d4e453e399022981fc9ed"
256+
integrity sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==
257+
253258
"@babel/helper-validator-identifier@^7.9.5":
254259
version "7.9.5"
255260
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.5.tgz#90977a8e6fbf6b431a7dc31752eee233bf052d80"
@@ -288,6 +293,11 @@
288293
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.5.tgz#cbf45321619ac12d83363fcf9c94bb67fa646d71"
289294
integrity sha512-KNlOe9+/nk4i29g0VXgl8PEXIRms5xKLJeuZ6UptN0fHv+jDiriG+y94X6qAgWTR0h3KaoM1wK5G5h7MHFRSig==
290295

296+
"@babel/parser@^7.12.0":
297+
version "7.13.10"
298+
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.13.10.tgz#8f8f9bf7b3afa3eabd061f7a5bcdf4fec3c48409"
299+
integrity sha512-0s7Mlrw9uTWkYua7xWr99Wpk2bnGa0ANleKfksYAES8LpWH4gW1OUr42vqKNf0us5UQNfru2wPqMqRITzq/SIQ==
300+
291301
"@babel/parser@^7.7.4", "@babel/parser@^7.7.5", "@babel/parser@^7.8.3", "@babel/parser@^7.8.4":
292302
version "7.8.4"
293303
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.8.4.tgz#d1dbe64691d60358a974295fa53da074dd2ce8e8"
@@ -860,6 +870,15 @@
860870
lodash "^4.17.13"
861871
to-fast-properties "^2.0.0"
862872

873+
"@babel/types@^7.12.0":
874+
version "7.13.0"
875+
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.13.0.tgz#74424d2816f0171b4100f0ab34e9a374efdf7f80"
876+
integrity sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA==
877+
dependencies:
878+
"@babel/helper-validator-identifier" "^7.12.11"
879+
lodash "^4.17.19"
880+
to-fast-properties "^2.0.0"
881+
863882
"@babel/types@^7.3.3", "@babel/types@^7.8.6":
864883
version "7.9.5"
865884
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.9.5.tgz#89231f82915a8a566a703b3b20133f73da6b9444"
@@ -2683,6 +2702,25 @@
26832702
"@vue/babel-plugin-transform-vue-jsx" "^1.1.2"
26842703
camelcase "^5.0.0"
26852704

2705+
2706+
version "3.0.7"
2707+
resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.0.7.tgz#421782a4c67cc3f2b7c30457ef446d74f8524f74"
2708+
integrity sha512-JFohgBXoyUc3mdeI2WxlhjQZ5fakfemJkZHX8Gu/nFbEg3+lKVUZmNKWmmnp9aOzJQZKoj77LjmFxiP+P+7lMQ==
2709+
dependencies:
2710+
"@babel/parser" "^7.12.0"
2711+
"@babel/types" "^7.12.0"
2712+
"@vue/shared" "3.0.7"
2713+
estree-walker "^2.0.1"
2714+
source-map "^0.6.1"
2715+
2716+
2717+
version "3.0.7"
2718+
resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.0.7.tgz#54d2e12fb9a7aff53abd19dac2c2679533f0c919"
2719+
integrity sha512-VnIH9EbWQm/Tkcp+8dCaNVsVvhm/vxCrIKWRkXY9215hTqOqQOvejT8IMjd2kc++nIsYMsdQk6H9qqBvoLe/Cw==
2720+
dependencies:
2721+
"@vue/compiler-core" "3.0.7"
2722+
"@vue/shared" "3.0.7"
2723+
26862724
"@vue/component-compiler-utils@^3.1.0":
26872725
version "3.1.1"
26882726
resolved "https://registry.yarnpkg.com/@vue/component-compiler-utils/-/component-compiler-utils-3.1.1.tgz#d4ef8f80292674044ad6211e336a302e4d2a6575"
@@ -2698,6 +2736,35 @@
26982736
source-map "~0.6.1"
26992737
vue-template-es2015-compiler "^1.9.0"
27002738

2739+
2740+
version "3.0.7"
2741+
resolved "https://registry.yarnpkg.com/@vue/reactivity/-/reactivity-3.0.7.tgz#e6ccc7bef7fc10b0972e4d974bad71679d3b26ad"
2742+
integrity sha512-FotWcNNaKhqpFZrdgsUOZ1enlJ5lhTt01CNTtLSyK7jYFgZBTuw8vKsEutZKDYZ1XKotOfoeO8N3pZQqmM6Etw==
2743+
dependencies:
2744+
"@vue/shared" "3.0.7"
2745+
2746+
2747+
version "3.0.7"
2748+
resolved "https://registry.yarnpkg.com/@vue/runtime-core/-/runtime-core-3.0.7.tgz#d44c0b0a57d7e392912a87362a4430ccf446ecea"
2749+
integrity sha512-DBAZAwVvdmMXuyd6/9qqj/kYr/GaLTmn1L2/QLxLwP+UfhIboiTSBc/tUUb8MRk7Bb98GzNeAWkkT6AfooS3dQ==
2750+
dependencies:
2751+
"@vue/reactivity" "3.0.7"
2752+
"@vue/shared" "3.0.7"
2753+
2754+
2755+
version "3.0.7"
2756+
resolved "https://registry.yarnpkg.com/@vue/runtime-dom/-/runtime-dom-3.0.7.tgz#b70668d729020bc4ad608c20367223f259576ba6"
2757+
integrity sha512-Oij4ruOtnpQpCj+/Q3JPzgpTJ1Q7+N67pA53A8KVITEtxfvKL46NN6dhAZ5NGqwX6RWZpYqWQNewITeF0pHr8g==
2758+
dependencies:
2759+
"@vue/runtime-core" "3.0.7"
2760+
"@vue/shared" "3.0.7"
2761+
csstype "^2.6.8"
2762+
2763+
2764+
version "3.0.7"
2765+
resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.0.7.tgz#96d52988efc07444c108c7c6803ba7cc93e40045"
2766+
integrity sha512-dn5FyfSc4ky424jH4FntiHno7Ss5yLkqKNmM/NXwANRnlkmqu74pnGetexDFVG5phMk9/FhwovUZCWGxsotVKg==
2767+
27012768
"@vuepress/[email protected]":
27022769
version "1.8.2"
27032770
resolved "https://registry.yarnpkg.com/@vuepress/core/-/core-1.8.2.tgz#4f5bafc894691bfea4146294a582a129483daf2a"
@@ -5183,6 +5250,11 @@ cssstyle@^2.0.0:
51835250
dependencies:
51845251
cssom "~0.3.6"
51855252

5253+
csstype@^2.6.8:
5254+
version "2.6.16"
5255+
resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.16.tgz#544d69f547013b85a40d15bff75db38f34fe9c39"
5256+
integrity sha512-61FBWoDHp/gRtsoDkq/B1nWrCUG/ok1E3tUrcNbZjsE9Cxd9yzUirjS3+nAATB8U4cTtaQmAHbNndoFz5L6C9Q==
5257+
51865258
currently-unhandled@^0.4.1:
51875259
version "0.4.1"
51885260
resolved "https://registry.yarnpkg.com/currently-unhandled/-/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea"
@@ -14163,7 +14235,16 @@ vue-toasted@^1.1.25:
1416314235
resolved "https://registry.yarnpkg.com/vue-toasted/-/vue-toasted-1.1.27.tgz#ce0a74b875f90c2e4a9e163cce6d5fc37d78a07c"
1416414236
integrity sha512-GVbwInwnqkVxQ4GU/XYeQt1e0dAXL8sF5Hr1H/coCBbYUan5xP0G2mEz/HRDf1lt73rFQAN/bJcLTOKkqiM6tg==
1416514237

14166-
vue@^2.6.10, vue@^2.6.11:
14238+
14239+
version "3.0.7"
14240+
resolved "https://registry.yarnpkg.com/vue/-/vue-3.0.7.tgz#8bcff51f8be570f9e4ce8cc5f52e2ab0fe3c74a1"
14241+
integrity sha512-8h4TikD+JabbMK9aRlBO4laG0AtNHRPHynxYgWZ9sq1YUPfzynd9Jeeb27XNyZytC7aCQRX9xe1+TQJuc181Tw==
14242+
dependencies:
14243+
"@vue/compiler-dom" "3.0.7"
14244+
"@vue/runtime-dom" "3.0.7"
14245+
"@vue/shared" "3.0.7"
14246+
14247+
vue@^2.6.10:
1416714248
version "2.6.12"
1416814249
resolved "https://registry.yarnpkg.com/vue/-/vue-2.6.12.tgz#f5ebd4fa6bd2869403e29a896aed4904456c9123"
1416914250
integrity sha512-uhmLFETqPPNyuLLbsKz6ioJ4q7AZHzD8ZVFNATNyICSZouqP2Sz0rotWQC8UNBF6VGSCs5abnKJoStA6JbCbfg==
@@ -14207,10 +14288,10 @@ vuepress@^1.1.0:
1420714288
opencollective-postinstall "^2.0.2"
1420814289
update-notifier "^4.0.0"
1420914290

14210-
vuex@^3.1.1:
14211-
version "3.6.2"
14212-
resolved "https://registry.yarnpkg.com/vuex/-/vuex-3.6.2.tgz#236bc086a870c3ae79946f107f16de59d5895e71"
14213-
integrity sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw==
14291+
vuex@^4.0.0:
14292+
version "4.0.0"
14293+
resolved "https://registry.yarnpkg.com/vuex/-/vuex-4.0.0.tgz#ac877aa76a9c45368c979471e461b520d38e6cf5"
14294+
integrity sha512-56VPujlHscP5q/e7Jlpqc40sja4vOhC4uJD1llBCWolVI8ND4+VzisDVkUMl+z5y0MpIImW6HjhNc+ZvuizgOw==
1421414295

1421514296
w3c-hr-time@^1.0.1:
1421614297
version "1.0.1"

0 commit comments

Comments
 (0)