-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
refactor: change primitive to shallowRef
, rename ref
usage to deepRef
#4582
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
Conversation
shallowRef
, rename ref
usage to deepRef
shallowRef
, rename ref
usage to deepRef
shallowRef
, rename ref
usage to deepRef
Some personal thoughts on the PR & Ideas:
|
|
Thanks for the insights @antfu! Do you think the move to |
I don't honestly sure what would be the best practice for this. Theoretically, yes, I think |
@@ -12,7 +12,7 @@ export const OnLongPress = /* #__PURE__ */ defineComponent<OnLongPressProps>({ | ||
props: ['as', 'options'] as unknown as undefined, | ||
emits: ['trigger'], | ||
setup(props, { slots, emit }) { | ||
const target = ref() | ||
const target = deepRef() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be a shallowRef
too? since its a ref to an element afaict
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I was using a simple regexp to replace those simple ones to shallow, I didn't go through these details (requires context) in this pr. Definitely something for the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
@antfu there's various places where we use a deepRef
but possibly shouldn't. i'll ping you on discord and, if im right, will open separate PRs 👍
Part of #4575
This PR is a refactor, should not introduce any behavioral change
ref(0)
toshallowRef(0)
ref()
usage todeepRef()
(alias fromref()
) for better explicitnessref()
usage