-
Notifications
You must be signed in to change notification settings - Fork 88
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(NcAppNavigationItem): use $scopedSlots instead of $slots #6161
Conversation
this.hasChildren = !!this.$scopedSlots.default | ||
this.collapsible = this.allowCollapse && !!this.$scopedSlots.default |
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'm not sure, $scopedSlots
is always available in beforeUpdate
in Vue 2.
Also, !!this.$slots.default
is false
when the is this.$scopedSlots.default
with an empty result.
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.
Let's remove hasChildren
completely, it can be replaced with this.$scopedSlots.default
in the template.
And collapsible
I'd replace with a method, so we don't change state before update and directly call it during the render.
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 agree, the logic is a bit hacky. I refactored the code according to your recommendations and pushed another commit.
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.
LGTM
Could you test that it still works dynamically generated content, when the list is empty? |
Signed-off-by: Richard Steinmetz <[email protected]>
What exactly do you mean with "dynamically generated content"? I tested it in Mail with my latest changes. The collapse toggle will be shown when there are children (and collapsing is allowed via the prop). Otherwise, it won't be shown. |
ff8ebf2
to
16702a3
Compare
/backport to next |
The backport to # Switch to the target branch and update it
git checkout next
git pull origin next
# Create the new backport branch
git checkout -b backport/6161/next
# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts, resolve them
git cherry-pick 16702a37
# Push the cherry pick commit to the remote repository and open a pull request
git push origin backport/6161/next Error: No changes found in backport branch Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports. |
When the value of children dynamically changes from 0 to N and back without component re-mounting.
Tested on netlify that if works fine now. |
☑️ Resolves
Ref https://v2.vuejs.org/v2/api/#vm-scopedSlots
🖼️ Screencasts
Before
Bildschirmaufnahme_20241022_194043.webm
After
Bildschirmaufnahme_20241022_193652.webm
🏁 Checklist
next
requested with a Vue 3 upgrade