Skip to content

Open the file when the fileid changes and openfile is set#45569

Closed
artonge wants to merge 1 commit intomasterfrom
artonge/fix/opening_a_secondly_created_file
Closed

Open the file when the fileid changes and openfile is set#45569
artonge wants to merge 1 commit intomasterfrom
artonge/fix/opening_a_secondly_created_file

Conversation

@artonge
Copy link
Contributor

@artonge artonge commented May 29, 2024

When opening a file, the openfile query parameter is set to true. This stays in the URL even after the viewer was closed.
After that, when creating a new file, the fileId in the URL changes, but the openfile parameter stays to true. This does not trigger the watcher:

openFile(open: boolean) {
if (open) {
this.$nextTick(() => this.handleOpenFile(this.fileId))
}
},

If we want to automatically open newly created files, then we need to either:

I am not sure whether we want the openfile parameter to be reset when the Viewer is closed, so I went for the first solution.

Fix #45486

@artonge artonge requested a review from skjnldsv as a code owner May 29, 2024 16:30
@artonge artonge requested a review from susnux May 29, 2024 16:33
@artonge artonge self-assigned this May 29, 2024
@artonge artonge added this to the Nextcloud 30 milestone May 29, 2024
@artonge
Copy link
Contributor Author

artonge commented May 29, 2024

/backport to stable29

@artonge
Copy link
Contributor Author

artonge commented May 29, 2024

/backport to stable28

When opening a file, the `openfile` query parameter is set to true. This stays in the URL even after the viewer was closed.
After that, when creating a new file, the file id in the URL changes, but the `openfile` parameter stays to true. This does not triggers the watcher: https://github.com/nextcloud/server/blob/a5fd623469b40c44881e4635de073d334b371bae/apps/files/src/components/FilesListVirtual.vue#L199.

If we want to automatically open newly created files, then we need to either check the `openfile` value in the `fileId` watcher, or reset the `openfile` parameter to false when the Viewer is closed. I am not sure whther we want the `openfile` parameter to be reset when the Viewer is closed, so I went for the first solution.

Signed-off-by: Louis Chemineau <louis@chmn.me>
@artonge artonge force-pushed the artonge/fix/opening_a_secondly_created_file branch from 8a52b5d to a06b7f4 Compare May 29, 2024 16:36
Copy link
Contributor

@susnux susnux left a comment

Choose a reason for hiding this comment

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

what happens if fileId and openFile change in the same tick?

@skjnldsv
Copy link
Member

I am not sure whether we want the openfile parameter to be reset when the Viewer is closed

I think we used to, it should definitely be the case.
The openfile should reflect the current view, if nothing is opened (aka, Viewer), then openfile should not be set. Refreshing the page should always lead to seeing the same UI (Grigorii mentionned that in another ticket too and I agree)

@artonge
Copy link
Contributor Author

artonge commented May 30, 2024

Replaced by nextcloud/viewer#2322

@artonge artonge closed this May 30, 2024
@skjnldsv skjnldsv removed this from the Nextcloud 30 milestone Aug 14, 2024
@susnux susnux deleted the artonge/fix/opening_a_secondly_created_file branch November 1, 2025 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Fail to create a second file in the Files web interface, unless I reload

3 participants