Skip to content

Conversation

@benjaminfrueh
Copy link
Contributor

Problem

Custom toolbar buttons disappear on toolbar re-render (e.g. when Excalidraw changes to mobile).
The hooks used reference guards to prevent duplicate button insertion. When Excalidraw rebuilt the toolbar these still held stale references to removed buttons, blocking re-insertion. Additionally, each hook implemented its own rendering logic.

Solution

  • Created a centralized configurable ToolbarButton component to handle the custom toolbar button rendering
  • Added a MutationObserver to watch for Excalidraw class changes and re-render buttons automatically
  • Refactored all toolbar button hooks (useEmojiPicker, useSmartPicker, useTableInsertion, useAssistant, useComment) to use the centralized component

@benjaminfrueh benjaminfrueh added the bug Something isn't working label Dec 16, 2025
@github-project-automation github-project-automation bot moved this to 🧭 Planning evaluation (don't pick) in 📝 Office team Dec 16, 2025
@benjaminfrueh benjaminfrueh moved this from 🧭 Planning evaluation (don't pick) to 👀 In review in 📝 Office team Dec 16, 2025
@benjaminfrueh benjaminfrueh force-pushed the fix/toolbar-buttons-render branch from 48e6fc4 to fd18bc9 Compare December 16, 2025 18:54
@github-actions
Copy link

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

Signed-off-by: Benjamin Frueh <benjamin.frueh@gmail.com>
Signed-off-by: Benjamin Frueh <benjamin.frueh@gmail.com>
@juliusknorr juliusknorr force-pushed the fix/toolbar-buttons-render branch from b117fe6 to ca86fbc Compare December 31, 2025 09:32
@juliusknorr
Copy link
Member

Rebased and resolved the conflicts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

3 participants