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: Use resize observer to calculate menubar icon limit #4637

Merged
merged 2 commits into from
Aug 7, 2023

Conversation

juliushaertl
Copy link
Member

@juliushaertl juliushaertl commented Aug 5, 2023

Signed-off-by: Julius Härtl [email protected]

📝 Summary

Make the icon limit recalculation more reliable by using a resize observer on the actual element and makes the code much cleaner

@vueuse/core is already a dependency through @nextcloud/vue

Fixes nextcloud/deck#4970

🏁 Checklist

  • Code is properly formatted (npm run lint / npm run stylelint / composer run cs:check)
  • Sign-off message is added to all commits
  • Tests (unit, integration and/or end-to-end) passing and the changes are covered with tests
  • Documentation (README or documentation) has been updated or is not required

@cypress
Copy link

cypress bot commented Aug 5, 2023

Passing run #11537 ↗︎

0 149 2 0 Flakiness 0

Details:

fix: Use resize observer to calculate menubar icon limit
Project: Text Commit: 088ef70a35
Status: Passed Duration: 03:56 💡
Started: Aug 7, 2023 1:38 PM Ended: Aug 7, 2023 1:42 PM

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

Copy link
Collaborator

@max-nextcloud max-nextcloud left a comment

Choose a reason for hiding this comment

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

Code changes look good. So much cleaner indeed.
I did not give it a try. Happy to hear it also fixes things in deck.
I have one minor question in the review.
Also... backports?

src/components/Menu/MenuBar.vue Show resolved Hide resolved
@juliushaertl
Copy link
Member Author

/compile

Copy link
Member

@mejo- mejo- left a comment

Choose a reason for hiding this comment

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

Thanks for looking into this! We still a listener on resize in getClientWidth() at src/store/plugin.js and in src/mixins/isMobile.js.

Also in src/components/Editor/EditorOutline.vue we implement our own $resizeObserver.

Maybe it would be good to consolidate all of them? 🤔

@juliushaertl
Copy link
Member Author

Sounds like a good idea. For the isMobile mixin we can actually rely on the one from @nextcloud/vue as it has a shared state and doesn't add another listener per usage.

I'd do that in a follow up to have the bugfix isolated for backports

@juliushaertl
Copy link
Member Author

Need to double check, cypress failure looks like it could be related not showing the menubar on direct editing.

https://cloud.cypress.io/projects/hx9gqy/runs/11522/test-results/9f7c840a-7788-4409-a6d1-cfd42c58408c

@juliushaertl
Copy link
Member Author

Pushed a fix to set the ready state in any case as for plain text files we don't have a resize observer as the menubar isn't there.

@juliushaertl
Copy link
Member Author

/compile amend /

@mejo- mejo- force-pushed the bugfix/noid/resize-menubar branch from 6e3ecf0 to 180cc39 Compare August 7, 2023 13:27
@mejo-
Copy link
Member

mejo- commented Aug 7, 2023

/compile

Signed-off-by: nextcloud-command <[email protected]>
@juliushaertl juliushaertl merged commit 44235cb into main Aug 7, 2023
31 checks passed
@juliushaertl juliushaertl deleted the bugfix/noid/resize-menubar branch August 7, 2023 13:42
@mejo-
Copy link
Member

mejo- commented Aug 7, 2023

/backport 180cc39 to stable27

@mejo-
Copy link
Member

mejo- commented Aug 7, 2023

/backport 180cc39 to stable26

@backportbot-nextcloud
Copy link

The backport to stable27 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable27
git pull origin stable27

# Create the new backport branch
git checkout -b fix/foo-stable27

# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts. Resolve them.
git cherry-pick abc123

# Push the cherry pick commit to the remote repository and open a pull request
git push origin fix/foo-stable27

More info at https://docs.nextcloud.com/server/latest/developer_manual/getting_started/development_process.html#manual-backport

@backportbot-nextcloud
Copy link

The backport to stable26 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable26
git pull origin stable26

# Create the new backport branch
git checkout -b fix/foo-stable26

# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts. Resolve them.
git cherry-pick abc123

# Push the cherry pick commit to the remote repository and open a pull request
git push origin fix/foo-stable26

More info at https://docs.nextcloud.com/server/latest/developer_manual/getting_started/development_process.html#manual-backport

@mejo-
Copy link
Member

mejo- commented Aug 7, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Not all formatting options show up
4 participants