Skip to content

fix(files): Open the sidebar for the current folder, not a stale child#61330

Open
nfebe wants to merge 2 commits into
masterfrom
fix/files-sidebar-stale-active-node
Open

fix(files): Open the sidebar for the current folder, not a stale child#61330
nfebe wants to merge 2 commits into
masterfrom
fix/files-sidebar-stale-active-node

Conversation

@nfebe

@nfebe nfebe commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

When opening the sidebar for a folder, the route still referenced the file id of a previously opened subfolder. Because that subfolder is listed inside the current folder, the sidebar restored its share and details context instead of the current folder's. The active file id is now kept in sync with the route, so a stale id can no longer be restored.

Before

Screencast.From.2026-06-16.01-26-10.webm

After

Screencast.From.2026-06-16.11-12-40.webm

@nfebe nfebe requested review from a team and skjnldsv as code owners June 16, 2026 10:15
@nfebe nfebe requested review from sorbaugh and susnux and removed request for a team June 16, 2026 10:15
@nfebe nfebe added the 3. to review Waiting for reviews label Jun 16, 2026
@github-project-automation github-project-automation Bot moved this to 🏗️ In progress in 📁 Files team Jun 16, 2026
@nfebe

nfebe commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

/backport to stable34

@nfebe

nfebe commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

/backport to stable33

@janepie

janepie commented Jun 16, 2026

Copy link
Copy Markdown
Member

/compile

@janepie

janepie commented Jun 18, 2026

Copy link
Copy Markdown
Member

/compile rebase

nfebe and others added 2 commits June 18, 2026 12:58
When opening the sidebar for a folder, the route still referenced the file id of a previously opened subfolder. Because that subfolder is listed inside the current folder, the sidebar restored its share and details context instead of the current folder's. The active file id is now kept in sync with the route, so a stale id can no longer be restored.

Signed-off-by: nfebe <fenn25.fn@gmail.com>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
@nextcloud-command nextcloud-command force-pushed the fix/files-sidebar-stale-active-node branch from 4799460 to 4624fb0 Compare June 18, 2026 13:03
Comment on lines +50 to +57
if (typeof activeNode.value?.fileid !== 'number') {
return
}

// Sync even when the active node is the current folder: skipping that case
// leaves a stale child fileid in the route, which then gets restored into
// the sidebar when it reopens.
if (String(activeNode.value.fileid) === String(window.OCP.Files.Router.params?.fileid ?? '')) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (typeof activeNode.value?.fileid !== 'number') {
return
}
// Sync even when the active node is the current folder: skipping that case
// leaves a stale child fileid in the route, which then gets restored into
// the sidebar when it reopens.
if (String(activeNode.value.fileid) === String(window.OCP.Files.Router.params?.fileid ?? '')) {
if (!activeNode.value?.id) {
return
}
// Sync even when the active node is the current folder: skipping that case
// leaves a stale child fileid in the route, which then gets restored into
// the sidebar when it reopens.
if (activeNode.value.id === String(window.OCP.Files.Router.params?.fileid ?? '')) {

.fileid is deprecated

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

Labels

Projects

Status: 🏗️ In progress

Development

Successfully merging this pull request may close these issues.

5 participants