-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Add delay before showing Reconnection UI #24137
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
Conversation
Thanks for submitting this PR, @SQL-MisterMagoo! Feel free to move it from draft to review-ready whenever you'd like us to take a look at it. |
@captainsafia I was waiting to see if the tests passed but it looks like some failed - - I couldn't tell for sure if that was related to this change or something else as it looks platform related which doesn't feel like a code issue? I'll start the review process anyway :) |
@SQL-MisterMagoo One test failure that looks suspicious is that of the |
@captainsafia
|
@SQL-MisterMagoo Sounds good! We might end up needing to modify that E2E test to account for the delay and only check for the element on the page after a certain amount of time. |
@captainsafia I discovered (new stuff!) jest useFakeTimers and that seems to have resolved the timing issues - and I found a copy-paste issue so the DefaultReconnectDisplay tests are passing for me. However, that are still test failures in the E2E tests - but to my eye they appear to be unrelated to the code changes I made. I am going to switch back to the master branch locally and run the tests again to see if those same E2E tests are failing. I cannot see any evidence of ReloadingThePage_GracefullyDisconnects_TheCurrentCircuit failing locally in this commit, but we'll have to see what the CI tests show. thanks for you help! |
Thanks for contributing this! Is there a reason to prefer implementing the delay in JS and not in CSS? I was thinking a CSS approach would be simpler and more robust, because it means we don't have to worry about scenarios like cancelling the delayed appearance of the UI if we happen to reconnect during the delay period. |
@SteveSandersonMS That is the kindest way of putting it 😄 you are, of course, right - I had missed that little problem. I opted for using setTimeout because I couldn't see a nice way to make use of CSS here - you mentioned keyframes previously, I think - but at the moment, the only styling is inline on the I could add a |
The reconnection model already has an ID ( |
Any pointers on where to find the template css would be greatly appreciated 😄 |
@SQL-MisterMagoo The CSS for the Blazor server template is located at https://github.com/dotnet/aspnetcore/tree/master/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/wwwroot/css. |
All, many many thanks for this. @SQL-MisterMagoo in particular you're a star here. The idea from @SteveSandersonMS makes crystal clear sense. This is actually something I may be able to assist with @SQL-MisterMagoo if you want. Let me know on Gitter please if that's the case. |
Could I have your thought on this - we could simply modify the template CSS - but I think it involves this substring selector: #components-reconnect-modal[style*="display: block"],
#components-reconnect-modal[style*="display:block"] {
animation: VISIBILITY 500ms linear;
}
@keyframes VISIBILITY {
0%,99% { visibility: hidden; }
100% { visibility: visible; }
} An alternative I was considering would be to add/remove a CSS class to control the animation delay : #components-reconnect-modal.show {
animation: VISIBILITY 500ms linear;
} And then the code in the DefaultReconnectDisplay would need to change to toggle the class In either case, I have yet to assess how a test would work for a CSS animation - my initial googling suggests that testing for the state of the modal at the end of the animation would be difficult - any thoughts on this? |
I like the testability and explicitness of this pattern.
I don't think you actually need to test the animation if the pattern above is used. We'd just need to test if the |
@captainsafia Thanks for the response, I'll switch over to setting the class. I'm a little cautious about updating the PR right now as I haven't been able to run successful tests on the master branch for a few days - it seems like something is broken in the repo - I've pulled the latest and done a clean, a restore, a build - they all work but build -test fails every time. |
@SQL-MisterMagoo Trying running the tests from inside the VS test explorer. If you want to run them from the command line, you'll probably have better luck using |
048e45f
to
b507665
Compare
Gah I thought I'd rebased recently enough, I'll try to do it again to fix the conflict |
b507665
to
182f0eb
Compare
@captainsafia Could you please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. We have two follow-ups to this:
- Submit a patch with this change to 3.1 (I'll take care of this)
- Notify users running into this issue of this change so they can implement it themselves in their codebases
@SQL-MisterMagoo Oof. Looks like you need to regenerate the blazor.server.js file one last time to resolve the merge conflicts. |
@captainsafia I don't get any diff from rebuilding that file - is this conflict because you are going to patch against a different branch? Should I rebase onto a different branch? |
The rebase should happen against master. You can try running:
This should pull in new changes to some of the files in Web.JS folder. It should also prompt you about a conflict in the |
182f0eb
to
21fcfcf
Compare
21fcfcf
to
98ea53c
Compare
@captainsafia I had to try a couple of times - I got unlucky and another commit updated the JS file after I rebased but before I pushed ! |
Hello @captainsafia! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
* Add CSS delay before showing Reconnection UI * rebuild yet again to try and get past the conflict
* Add CSS delay before showing Reconnection UI * rebuild yet again to try and get past the conflict
* Disconnect circuit on `beforeunload` event (#23224) * Add delay before showing Reconnection UI (#24137) * Add CSS delay before showing Reconnection UI * rebuild yet again to try and get past the conflict * Move reconnection delay mechanism into framework code (#24566) Co-authored-by: SQL-MisterMagoo <[email protected]> Co-authored-by: Steve Sanderson <[email protected]>
Summary of the changes (Less than 80 chars)
Addresses #19050