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(types): UnwrapRef should unwrap refs in collections when reading objects #4899

Closed

Conversation

JensDll
Copy link
Contributor

@JensDll JensDll commented Nov 3, 2021

UnwrapRef does not represent the ref unwrapping behavior correctly for refs in native collections (refs are unwrapped when reading from objects).

Sandbox link to reproduction

The branch is based on #3820 because it is not merged yet.
To make it simpler to follow, I removed the changes in #3820 and just included the ones for this feature.

  • I can add test cases for this later if the changes are fine.

Copy link
Member

@posva posva left a comment

Choose a reason for hiding this comment

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

Can you remove the changes to the lock and rebase from master?

@JensDll JensDll force-pushed the fix_unwrap_ref_in_collection_types branch from 1d2b4bd to 2754820 Compare November 3, 2021 19:48
@@ -66,9 +66,6 @@ export function isRef(r: any): r is Ref {
return Boolean(r && r.__v_isRef === true)
}

export function ref<T extends object>(
value: T
): [T] extends [Ref] ? T : Ref<UnwrapRef<T>>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't see the use case for this overload. Am I missing something here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like this was added in #4734.
Should be save to remove as the added test still passes.

@JensDll JensDll force-pushed the fix_unwrap_ref_in_collection_types branch 4 times, most recently from e13e797 to a563b7c Compare November 18, 2021 20:06
@JensDll JensDll changed the title fix(types): UnwrapRef should unwrap refs in collections fix(types): UnwrapRef should unwrap refs in collections when reading objects Nov 18, 2021
@JensDll JensDll force-pushed the fix_unwrap_ref_in_collection_types branch from a563b7c to eb4a784 Compare November 26, 2021 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Rejected
Development

Successfully merging this pull request may close these issues.

None yet

2 participants