-
Notifications
You must be signed in to change notification settings - Fork 728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error "Trying to start a new request while another is active" in browser while setting the theme, pushing, and adding a grid in the same request. #11954
Comments
I initially thought it was reproducible with a |
What version of vaadin are you using? |
If you're using background threads to update your UI you should always provide them with the UI instance as since vaadin version 8 the UI.getCurrent() is a weak reference to avoid memory leaks. // This should be called from the main UI thread.
final UI ui = UI.getCurrent(); or preferably when calling from within a Component // From within the component
final UI ui = getUI(); Then what you should do is wrap your code used in the ClickListener in a final UI ui = UI.getCurrent();
ui.access(() -> {
ui.setTheme("mytheme2");
ui.push();
layout.addComponent(new Grid<>());
})
Hope this helps |
Hi @ShawnRG . Thanks for your reply, but as you can see from the MWE it's not an issue with background threads. It should be reproducible with any Vaadin 8.X version. It seems to be an issue with Vaadin's I have made a PoC for a solution here |
There might be pending requests in the queue when a resync request is made (e.g. through a theme change). This can cause conflicts if the resync request is handled immediately. Therefore the resync request should also be added to the queue and only get resolved when doSendInvocationsToServer() gets triggered again. Consequently we can also avoid unnecessary replacing of elements that simply have their theme changed while still updating elements that display theme resources where the resource url changes with the theme change. Fixes vaadin#11954
There might be pending requests in the queue when a resync request is made (e.g. through a theme change). This can cause conflicts if the resync request is handled immediately. Therefore the resync request should also be added to the queue and only get resolved when doSendInvocationsToServer() gets triggered again. Consequently we can also avoid unnecessary replacing of elements that simply have their theme changed while still updating elements that display theme resources where the resource url changes with the theme change. Fixes vaadin#11954
There might be pending requests in the queue when a resync request is made (e.g. through a theme change). This can cause conflicts if the resync request is handled immediately. Therefore the resync request should also be added to the queue and only get resolved when doSendInvocationsToServer() gets triggered again. Fixes vaadin#11954
There might be pending requests in the queue when a resync request is made (e.g. through a theme change). This can cause conflicts if the resync request is handled immediately. Therefore the resync request should also be added to the queue and only get resolved when doSendInvocationsToServer() gets triggered again. Fixes #11954
Steps to reproduce
2.1. Set the theme to an existing theme other than the current using
UI#setTheme
2.2. Manually push using
UI#push
2.3. Add a
Grid
Actual outcome
An error
Trying to start a new request while another is active
is displayed in the browser console.I believe this is the root cause of sometimes infinite resynchronizations of the page in a real application, but I have not been able to reproduce it completely. The real app does not use manual pushing, but it does have push enabled (long polling) and it accesses the UI from background threads.
Expected outcome
No errors in the console.
Example code
After clicking the first button, the theme must be reset before the error occurs again.
The text was updated successfully, but these errors were encountered: