fix(reactivity): fix iOS 12 JSON.stringify error on reactive objects
- Use WeakMap for raw -> reactive/readonly storage. This is slightly more expensive than using a field on the taget object but avoids polluting the original. - also fix Collection.forEach callback value fix #1916
This commit is contained in:
@@ -228,7 +228,7 @@ describe('reactivity/readonly', () => {
|
||||
test('should retrieve readonly values on iteration', () => {
|
||||
const key1 = {}
|
||||
const key2 = {}
|
||||
const original = new Collection([[key1, {}], [key2, {}]])
|
||||
const original = new Map([[key1, {}], [key2, {}]])
|
||||
const wrapped: any = readonly(original)
|
||||
expect(wrapped.size).toBe(2)
|
||||
for (const [key, value] of wrapped) {
|
||||
@@ -246,7 +246,7 @@ describe('reactivity/readonly', () => {
|
||||
test('should retrieve reactive + readonly values on iteration', () => {
|
||||
const key1 = {}
|
||||
const key2 = {}
|
||||
const original = reactive(new Collection([[key1, {}], [key2, {}]]))
|
||||
const original = reactive(new Map([[key1, {}], [key2, {}]]))
|
||||
const wrapped: any = readonly(original)
|
||||
expect(wrapped.size).toBe(2)
|
||||
for (const [key, value] of wrapped) {
|
||||
|
||||
Reference in New Issue
Block a user