-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
[feat] make existent props reactive and new whileElementsMount prop #1
base: main
Are you sure you want to change the base?
[feat] make existent props reactive and new whileElementsMount prop #1
Conversation
brings new goodies like autoUpdate and other core fixes
Hey, @renatodeleao thanks for the feature! Pushed a commit with types improvements. I think I will need to do a major version release because we updated
I would like to keep the same behaviour as the react-dom package, if they do so, we should also. |
Hey Andrew, thanks for the type fixes (and linting)!
If we're strict about it, yeah because that
Got it, I don't think they mutate them. They seem to assign them to the "data" object initially and then simply replace that object with |
1. Make sure that computePosition does not mutate original prop refs, even if react to it 1. returns computedData as refs that react the computePosition. This aligns the code better with what we have in the original package. As side-effect drop the _variable namespace in favour of a reactive object.
@iamandrewluca aligned the return values with the original package and the |
placement: unref(placement), | ||
strategy: unref(strategy), |
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.
The reactive conversion is "deep": it affects all nested properties. A reactive object also deeply unwraps any properties that are refs while maintaining reactivity.
– https://vuejs.org/api/reactivity-core.html#reactive
unref
can be omitted
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.
I think the key part is "unwraps
while maintaining reactivity", we don't want to keep reactivity or it would mutate original props refs as before. We just want o use its value like an initial value. EDIT: Also, since we can provide static strings as props, unref
does the isRef(prop) ? prop.value : prop
for us.
Hey 👋 nicely done with the conversion and the video walkthrough!
I'm not sure if you did it just for the video /fun or if you have any intentions of maintaining this package. If that so, I would be interested to help. It's a shame that
Vue
does not have a first-class citizen wrapper for this package and the alternatives are a bit bloated instead of keeping the low-level premise of the original package.Changes
autoUpdate
util.Ref
forplacement
with the value ofright
, but since we have theflip()
modifier the computed placement will actually beleft
, so toggling it to "right" on the consumer will actually result in it being mutated toleft
. Happy to hear your input on it.whileElementsMounted
prop matching the react packageTypescript
I'm not very proficient in typescript (as you can see by the code), so I would also use this as a learning experience. The types need to be corrected before building this fixes and features.
Future
Cheers!