Skip to content
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

fix: not unwrapping markRaw objects #386

Merged
merged 2 commits into from Jun 19, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/reactivity/unwrap.ts
Expand Up @@ -29,8 +29,8 @@ export function unwrapRefProxy(value: any, map = new WeakMap()) {

for (const k of Object.keys(value)) {
const r = value[k]
// don't unwrap or do anything to raw
if (isRaw(r)) {
// don't process on falsy or raw
if (!r || isRaw(r)) {
Copy link
Member

Choose a reason for hiding this comment

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

Would it better to check falsy inside isRaw?

Copy link
Member Author

Choose a reason for hiding this comment

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

export function isRaw(obj: any): boolean {
  return !!obj && hasOwn(obj, RawIdentifierKey) && obj[RawIdentifierKey] === RawIdentifier;
}

Not sure if is will help, the idea is if is isRaw it shouldn't do anything to the object.

even if I add that condition on isRaw I still need to do unwrap, since we don't need to process falsy values

obj[k] = r
}
// if is a ref, create a proxy to retrieve the value,
Expand Down