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
DEV: allows for multiple menus/tooltips #26823
DEV: allows for multiple menus/tooltips #26823
Conversation
43ea1f3
to
41b4df0
Compare
menus and tooltips are now appended to their own portals. The service are the only responsible for managing the instances, prior to this commit, services could manage one instance, but the DMenu and DTooltip components could also take over which could cause unexpected states. This change also allows nested menus/tooltips. Other notable changes: few months ago core copied the CloseOnClickOutside modifier of float-kit without removing the float-kit one, this commit now only use the core one. the close function is now trully async the close function accepts an instance or an identifier as parameter
41b4df0
to
702c053
Compare
app/assets/javascripts/float-kit/addon/components/d-tooltip.gjs
Outdated
Show resolved
Hide resolved
@tracked tooltipInstance = null; | ||
registerTrigger = modifier((element) => { | ||
if (!this.tooltipInstance?.trigger) { | ||
next(() => { |
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.
What breaks without this next()
? 😄
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 world.
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.
More seriously I had exceptions in tests I think
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.
@CvX here is the exact error without the next:
global failure: Error: Assertion Failed: You attempted to update _trigger
on DTooltipInstance
, but it had already been used previously in the same computation. Attempting to update a value after using it in a computation can cause logical errors, infinite revalidation bugs, and performance issues, and is not supported.
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 will merge with the next for now, but open to a better solution if you know one
menus and tooltips are now appended to their own portals. The service are the only responsible for managing the instances, prior to this commit, services could manage one instance, but the DMenu and DTooltip components could also take over which could cause unexpected states.
This change also allows nested menus/tooltips.
Other notable changes:
CloseOnClickOutside
modifier of float-kit without removing the float-kit one, this commit now only use the core one.