joplin icon indicating copy to clipboard operation
joplin copied to clipboard

Desktop: Fixes #10060: Fix "New note" button rendering when startup with Trash can selected.

Open khuongduy354 opened this issue 2 years ago • 3 comments

Summary

Previously, New note button ref is stored by useRef, which doesn't trigger rerender when ref change. This cause if the Trash can is selected in previous session, when reopen the app, the ref to New note is null by default, preventing the New note button to re-render into correct format. More details and how to reproduce bugs: #10060.

Solution notes

  • Changed useRef to useState instead for storing New note button element.
  • I think panel width unchanged should not prevent re-render. There might be cases where element change needs re-render but panel width doesn't change (toggle button visibility for example). So i remove this line image

Testing

  1. Open Joplin, create an empty notebook in root
  2. Click on Trash can (make sure the New note button is hidden, Trash can is collapsed)
  3. Shrink the panel with search bar as small as possible.
  4. Close & reopen Joplin
  5. Click on the notebook in step 1, New note button should appear in correct format for small screen (which is an icon).

khuongduy354 avatar Mar 07 '24 06:03 khuongduy354

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

github-actions[bot] avatar Mar 07 '24 06:03 github-actions[bot]

I have read the CLA Document and I hereby sign the CLA

khuongduy354 avatar Mar 07 '24 07:03 khuongduy354

I forgot to mention, I'm participating GSoC 2024. This is my introduction: https://discourse.joplinapp.org/t/introduction-duy-huynh/36448

khuongduy354 avatar Mar 07 '24 15:03 khuongduy354

Looks good now, thanks @khuongduy354 for looking into this!

laurent22 avatar Mar 15 '24 09:03 laurent22