expect(d.value).toBe('e')
})
- it.skip('setup store', () => {
+ it('setup store', () => {
const store = defineStore('a', () => {
return {
a: ref<null | undefined>(null),
expect(r.value).toEqual({ n: 2 })
expect(store.r).toEqual({ n: 2 })
store.r.n++
- expect(r.value).toEqual({ n: 2 })
- expect(store.r).toEqual({ n: 2 })
+ expect(r.value).toEqual({ n: 3 })
+ expect(store.r).toEqual({ n: 3 })
})
it('empty getters', () => {
effectScope,
EffectScope,
ComputedRef,
+ toRaw,
toRef,
toRefs,
Ref,
})
} else {
assign(store, setupStore)
+ // allows retrieving reactive objects with `storeToRefs()`. Must be called after assigning to the reactive object.
+ // https://github.com/posva/pinia/issues/799
+ assign(toRaw(store), setupStore)
}
// use this instead of a computed with setter to be able to create it anywhere