Skip to content
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

no dispatchGlobalEventToAllElements when no renderer attached #58667

Open
wants to merge 1 commit into
base: release/8.0
Choose a base branch
from

Conversation

zuizuihao
Copy link

ROOT CAUSE

when Blazor connection closed, the detachWebRendererInterop in the callback of connection.onclose will be invoked. here, it will invoke interopMethodsByRenderer.delete(rendererId);, all the interopMethodsByRenderer will be cleaned. also There are lots of global event listener in form.js like window.addEventListener('focus'), window.addEventListener('keydown'). if user still interact with our app like focus, click, the global event will be triggered, then invoked EventDelegator.onGlobalEvent, invoked EventDelegator.dispatchGlobalEventToAllElements invoked WebRendererInteropMethods.dispatchEvent invoked WebRendererInteropMethods.getInteropMethods, here since the interopMethodsByRenderer is empty, will throw this exception.

SOLUTION:

check isRendererAttached before dispatchGlobalEventToAllElements in EventDelegator

Fixes #57828

Before Fixes:
no_interop_methods_for_render

After Fixes:
no_interop_methods_for_render_solution

@zuizuihao zuizuihao requested a review from a team as a code owner October 28, 2024 07:43
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Oct 28, 2024
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Oct 28, 2024
Copy link
Contributor

Thanks for your PR, @zuizuihao. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service bot added this to the 8.0.x milestone Oct 28, 2024
Copy link
Contributor

Hi @zuizuihao. If this is not a tell-mode PR, please make sure to follow the instructions laid out in the servicing process document.
Otherwise, please add tell-mode label.

Copy link
Contributor

Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime.
To make sure no conflicting changes have occurred, please rerun validation before merging. You can do this by leaving an /azp run comment here (requires commit rights), or by simply closing and reopening.

@dotnet-policy-service dotnet-policy-service bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Nov 5, 2024
@zuizuihao
Copy link
Author

/azp run

Copy link

Commenter does not have sufficient privileges for PR 58667 in repo dotnet/aspnetcore

@zuizuihao
Copy link
Author

any progress on it @javiercn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components community-contribution Indicates that the PR has been added by a community member pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants