Skip to content

🐛(frontend) show the sub-docs modal when duplicating a doc - #2860

Merged
AntoLC merged 3 commits into
mainfrom
fix/2797-duplicate-subdocs-modal
Oct 21, 2026
Merged

AntoLC merged 3 commits into
mainfrom
fix/2797-duplicate-subdocs-modal

Conversation

@AntoLC

@AntoLC AntoLC commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Purpose

Duplicating a doc that has sub-docs sometimes skipped the confirmation modal and silently left the sub-docs out of the copy. The duplicate action was reading a stale numchild of the parent, and a reader's duplicate was wrongly added to the doc tree.

Proposal

  • Only offer to duplicate the children when the user is allowed to
  • Keep the numchild of the parent up to date when a sub-doc is created (doc page cache) and when it is created, deleted or moved in the doc tree
  • Don't add the duplicate to the doc tree when the user can't edit the document: the backend creates it as a new root document

@AntoLC AntoLC added bug Something isn't working frontend labels Oct 19, 2026
@AntoLC AntoLC self-assigned this Oct 19, 2026
@AntoLC AntoLC linked an issue Oct 19, 2026 that may be closed by this pull request
1 task done
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Size Change: 0 B

Total Size: 4.08 MB

📦 View Changed
Filename Size Change
apps/impress/out/_next/static/36d638db/_buildManifest.js 741 B +741 B (new file) 🆕
apps/impress/out/_next/static/ceab0aa5/_buildManifest.js 0 B -741 B (removed) 🏆

compressed-size-action

@AntoLC AntoLC linked an issue Oct 19, 2026 that may be closed by this pull request
@AntoLC
AntoLC requested a review from Ovgodd October 19, 2026 14:41
@AntoLC
AntoLC force-pushed the fix/2797-duplicate-subdocs-modal branch from 883e71f to 3a4a2df Compare October 21, 2026 09:05
The sub-docs confirmation modal was not displayed
in some cases when duplicating a document with sub-docs.

Closes #2797

Signed-off-by: Anthony LC <[email protected]>
The sub-docs confirmation modal was skipped when duplicating a doc
right after creating, deleting or moving one of its sub-docs: the
duplicate action read a stale `numchild`.

Two copies of the parent were out of date. The doc page keeps it
cached for 30 seconds, and creating a sub-doc never invalidated it.
The doc tree also keeps its own copy, which react-query invalidations
do not reach, so it is now updated when a sub-doc is created, deleted
or moved by drag and drop. The move updates the nodes in place before
the move, as `updateNode` would bring the moved doc back under its old
parent.
When a user below editor duplicates a sub-document, the backend creates
the copy as a new root document owned by the user, since only editors
and above can write in the tree. The frontend still inserted the copy
in the displayed tree as a sibling of the original, showing a document
that does not belong there.

Only add the duplicate to the tree when the user can edit the document,
and make the toast "Undo" action leave the tree alone in the other case.
@AntoLC
AntoLC force-pushed the fix/2797-duplicate-subdocs-modal branch from 3a4a2df to 84ce311 Compare October 21, 2026 11:46
@AntoLC
AntoLC merged commit 84ce311 into main Oct 21, 2026
59 of 60 checks passed
@AntoLC
AntoLC deleted the fix/2797-duplicate-subdocs-modal branch October 21, 2026 12:10
lunika added a commit that referenced this pull request Oct 21, 2026
Added

- ✨(docspec) handle DocSpec 4xx/5xx import errors distinctly #2552
- 🌐(frontend) add Crowdin translator context #2785
- ✨(frontend) open the emoji picker when adding a document emoji #2777

Changed

- 💄(frontend) limit heading choices to levels 1–3

- ♻️(frontend) replace outdated AGPL mentions of BlockNote XL packages #2775
- 💄(frontend) update upload loader and error ui #2778
- ⬆️(yhub) upgrade @y/hub to 0.10.1 #2853
- ♿️(frontend) allow opening the home button in a new tab #2839
- 💄(frontend) use 12px for error page home links #2809

Fixed

- 🐛(frontend) don't add a reader's duplicate to the doc tree #2860
- 🐛(frontend) fix confirmation modal for duplicating sub-docs #2860
- 🐛(frontend) wrap long unbroken document titles #2852
- 🐛(frontend) wrap long text in the print export #2813
- 🔒️(backend) bind comment thread to the path document on creation #2838
- 🐛(frontend) fix search highlight hidden inside code blocks #2681
- 🔒️(backend) require present document access for thread and comment
  writes #2840
- 🐛(backend) enforce resource server action restrictions on the external
  API #2745
- 🐛(backend) mark only the top duplicate as a copy, after its title #2855
- 🐛(yhub) measure migration durations with a monotonic clock #2814
- 🐛(backend) send the mention email when the cache is unreachable #2803
- 🐛(backend) give media-auth its own throttle scope
- 💄(frontend) remove the vertical line next to nested blocks #2825
lunika added a commit that referenced this pull request Oct 21, 2026
Added

- ✨(docspec) handle DocSpec 4xx/5xx import errors distinctly #2552
- 🌐(frontend) add Crowdin translator context #2785
- ✨(frontend) open the emoji picker when adding a document emoji #2777

Changed

- 💄(frontend) limit heading choices to levels 1–3

- ♻️(frontend) replace outdated AGPL mentions of BlockNote XL packages #2775
- 💄(frontend) update upload loader and error ui #2778
- ⬆️(yhub) upgrade @y/hub to 0.10.1 #2853
- ♿️(frontend) allow opening the home button in a new tab #2839
- 💄(frontend) use 12px for error page home links #2809

Fixed

- 🐛(frontend) don't add a reader's duplicate to the doc tree #2860
- 🐛(frontend) fix confirmation modal for duplicating sub-docs #2860
- 🐛(frontend) wrap long unbroken document titles #2852
- 🐛(frontend) wrap long text in the print export #2813
- 🔒️(backend) bind comment thread to the path document on creation #2838
- 🐛(frontend) fix search highlight hidden inside code blocks #2681
- 🔒️(backend) require present document access for thread and comment
  writes #2840
- 🐛(backend) enforce resource server action restrictions on the external
  API #2745
- 🐛(backend) mark only the top duplicate as a copy, after its title #2855
- 🐛(yhub) measure migration durations with a monotonic clock #2814
- 🐛(backend) send the mention email when the cache is unreachable #2803
- 🐛(backend) give media-auth its own throttle scope
- 💄(frontend) remove the vertical line next to nested blocks #2825
lunika added a commit that referenced this pull request Oct 21, 2026
Added

- ✨(docspec) handle DocSpec 4xx/5xx import errors distinctly #2552
- 🌐(frontend) add Crowdin translator context #2785
- ✨(frontend) open the emoji picker when adding a document emoji #2777

Changed

- 💄(frontend) limit heading choices to levels 1–3

- ♻️(frontend) replace outdated AGPL mentions of BlockNote XL packages #2775
- 💄(frontend) update upload loader and error ui #2778
- ⬆️(yhub) upgrade @y/hub to 0.10.1 #2853
- ♿️(frontend) allow opening the home button in a new tab #2839
- 💄(frontend) use 12px for error page home links #2809

Fixed

- 🐛(frontend) don't add a reader's duplicate to the doc tree #2860
- 🐛(frontend) fix confirmation modal for duplicating sub-docs #2860
- 🐛(frontend) wrap long unbroken document titles #2852
- 🐛(frontend) wrap long text in the print export #2813
- 🔒️(backend) bind comment thread to the path document on creation #2838
- 🐛(frontend) fix search highlight hidden inside code blocks #2681
- 🔒️(backend) require present document access for thread and comment
  writes #2840
- 🐛(backend) enforce resource server action restrictions on the external
  API #2745
- 🐛(backend) mark only the top duplicate as a copy, after its title #2855
- 🐛(yhub) measure migration durations with a monotonic clock #2814
- 🐛(backend) send the mention email when the cache is unreachable #2803
- 🐛(backend) give media-auth its own throttle scope
- 💄(frontend) remove the vertical line next to nested blocks #2825
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛(Bug) Duplicate doc with sub-docs doesn't show confirmation modal 🐛(Bug) Duplicate bug when access through link sharing

2 participants