Skip to content

Conversation

@shethaadit
Copy link
Contributor

Fix: Handle null event.submitter in enhanced form submission

  • [Y] You've read the Contributor Guide and Code of Conduct.
  • [Y] You've included unit or integration tests for your change, where applicable.
  • [Y] You've included inline docs for your change, where applicable.
  • [Y] There's an open issue for the PR that you are making. If you'd like to propose a new feature or change, please open an issue to discuss the change or find an existing issue.

Description

  • This PR fixes an issue where calling requestSubmit on a form with the data-enhance attribute caused an uncaught TypeError due to accessing a member on a null event.submitter.
  • The change replaces the non-null assertion operator (!) with the optional chaining operator (?) to properly handle cases where event.submitter is null.

By addressing this, the form navigation is enhanced without throwing errors, ensuring smoother functionality and user experience.

Fixes #58244

@shethaadit shethaadit requested a review from a team as a code owner November 27, 2024 21:04
@ghost ghost added the area-blazor Includes: Blazor, Razor Components label Nov 27, 2024
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Nov 27, 2024
@shethaadit
Copy link
Contributor Author

Hi @mkArtakMSFT/team, could you please help review the PR and check test case failure?

@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 Dec 11, 2024
@javiercn javiercn merged commit 5a42e1e into dotnet:main Dec 13, 2024
27 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the 10.0-preview1 milestone Dec 13, 2024
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.

[Blazor] - Issue calling submitRequest on data-enhanced form

2 participants