Skip to content

Conversation

@juliusknorr
Copy link
Member

@juliusknorr juliusknorr commented Apr 25, 2024

When creating a new file from a template there is a race condition between the file opening and adding the entry to the file list (which is required by some apps like ONLYOFFICE to obtain further info).

This can be reproduced by setting browser throttling of network connections to be very slow with ONLYOFFICE.

In order to fix that we should wait for the success callback of addAndFetchFileInfo before we continue any further and try to open the file. Await is not working here due to the usage of $.Deferred()

@juliusknorr juliusknorr changed the title fix: Wait until file has been added to filelist before opening [stable27] fix: Wait until file has been added to filelist before opening Apr 25, 2024
@juliusknorr juliusknorr force-pushed the fix/template-race-27 branch from 164fa97 to ed747d6 Compare April 25, 2024 10:34
@juliusknorr juliusknorr added bug 3. to review Waiting for reviews labels Apr 25, 2024
@juliusknorr juliusknorr added this to the Nextcloud 27.1.10 milestone Apr 25, 2024
@Pytal
Copy link
Member

Pytal commented Apr 25, 2024

Await is not working here due to the usage of $.Deferred()

Strange as according to docs await should work on any thenable object 🤔

@juliusknorr
Copy link
Member Author

@Pytal Thanks, I was actually wrong with why this happened. It turned out the await was working but depending on the current folder and filename, the $file entry is empty if the file is added to the end of the list and therefore not rendered.

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

Labels

3. to review Waiting for reviews bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants