Skip to content

Conversation

@MichaelEPope
Copy link

This is a workaround for bug #893, where if you double click an item that opens in the viewer, it opens in a way that the viewer can't close. It works for the Viewer for Images, Videos, and PDFs for sure. I didn't test audio, but it probably works for it as well.

The main cause of the issue is that when a file is double clicked, the file is opened twice. However, something weird occurs when this happens. openFile() is only called once, while close() and cleanup() are immediately called. What I'm guessing happens is that the original file loads, and is closed somehow, followed by the second file opening. I'm not sure which of those files calls openFile() and which doesn't. One result of this though is that when the second file is closed, close() is called, but cleanup() is not. This patch ensures that it is called, which resolves the issue.

There are still some cases where the double clicking can cause the black background of the viewer to not appear (to get this to happen, you have to double click, but put some spaces between the clicks that are a part of the double click, it's difficult to get the timing right, so try it a few times). But this at least solves the one issue.

This is not really meant to be a permanent workaround probably. There are better things to do then run cleanup(), but I can't set up my development environment well enough to test it. But this is suitable for now.

Signed-off-by: Michael Pope [email protected]

Michael Pope added 2 commits April 21, 2022 11:32
…extcloud#893, where if you double click an item that opens in the viewer, it opens in a way that the viewer can't close.  It works for the Viewer for Images, Videos, and PDFs for sure.  I didn't test audio, but it probably works for it as well.  The main cause of the issue is that when a file is double clicked, the file is opened twice.  However, something weird occurs when this happens.  openFile() is only called once, while close() and cleanup() are immediately called.  What I'm guessing happens is that the original file loads, and is closed somehow, followed by the second file opening.  I'm not sure which of those files calls openFile() and which doesn't.  One result of this though is that when the second file is closed, close() is called, but cleanup() is not.  This patch ensures that it is called, which resolves the issue.  There are still some cases where the double clicking can cause the black background of the viewer to not appear (to get this to happen, you have to double click, but put some spaces between the clicks that are a part of the double click, it's difficult to get the timing right, so try it a few times).  But this at least solves the one issue.  This is not really meant to be a permanent workaround probably.  There are better things to do then run cleanup(), but I can't set up my development environment well enough to test it.  But this is suitable for now.

Signed-off-by: Michael Pope <[email protected]>
Signed-off-by: Michael Pope <[email protected]>
@szaimen
Copy link
Contributor

szaimen commented Apr 21, 2022

/compile amend /

@szaimen
Copy link
Contributor

szaimen commented Apr 21, 2022

I forgot: can you please compile the js and commit it to this branch? Then the node workflow will be fixed :)

Signed-off-by: Michael Pope <[email protected]>
@MichaelEPope
Copy link
Author

MichaelEPope commented Apr 21, 2022

I forgot: can you please compile the js and commit it to this branch? Then the node workflow will be fixed :)

Just committed it. :) Let me know if you need anything else with it.

@MichaelEPope MichaelEPope requested a review from szaimen April 21, 2022 20:37
Copy link
Contributor

@szaimen szaimen left a comment

Choose a reason for hiding this comment

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

double-clicking on a photo and closing the viewer afterwards works now but does result in this strange view in my testing. Not sure if this is expeced:
image

this is how it looks when clicking one time on a photo:
image

@MichaelEPope
Copy link
Author

MichaelEPope commented Apr 21, 2022

double-clicking on a photo and closing the viewer afterwards works now but does result in this strange view in my testing. Not sure if this is expeced: image

this is how it looks when clicking one time on a photo: image

Yeah, unfortunately I wasn't able to resolve that part of it. It doesn't trigger all the time, only if the double clicks are timed pretty precisely (at least on my end that was the case, it wouldn't trigger the white screen on fast or slow double clicks, just a very precise timing in the middle). There is something wrong with the state management that does that, but I couldn't quite figure out what (mentioned this a bit in #893). So I figured I'd at least put the initial fix for the closing issue in the pull request (because I find it a lot more annoying for people to have to refresh the page).

I can probably take a look at the white background later on... but it might be some time... we are going to have some things at work that make the next month or so kinda hectic. Let me know what you think, and what you'd like to do. If you want to wait on this until we resolve the white background issue, that's totally cool.

@szaimen
Copy link
Contributor

szaimen commented Apr 22, 2022

So I figured I'd at least put the initial fix for the closing issue in the pull request (because I find it a lot more annoying for people to have to refresh the page).

I can probably take a look at the white background later on... but it might be some time... we are going to have some things at work that make the next month or so kinda hectic. Let me know what you think, and what you'd like to do. If you want to wait on this until we resolve the white background issue, that's totally cool.

@skjnldsv please decide

@szaimen
Copy link
Contributor

szaimen commented May 17, 2022

Superseded by #1247

@szaimen szaimen closed this May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants