Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 2, 2025

This PR addresses a timing issue in enhanced navigation where NotFound calls made synchronously could reach the enhanced navigation code before proper initialization, causing undefined access errors.

Changes Made

1. Test URL Correction

Fixed NotFoundSetOnFormSubmit_ResponseNotStarted_SSR test to use the correct URL:

  • Before: /post-not-found-ssr-streaming (streaming enabled)
  • After: /post-not-found-ssr (streaming disabled)

The test name explicitly mentions "ResponseNotStarted" which should test non-streaming scenarios where the response hasn't started streaming yet.

2. Enhanced Navigation Timing Fix

The core issue was a race condition where synchronous NotFound calls could trigger performEnhancedPageLoad before navigationEnhancementCallbacks was initialized.

Root Cause: When forms submit and immediately call NotFound, the enhanced navigation code path executes before the boot function completes initialization.

Solution:

  • Moved enhanced navigation initialization earlier in the boot function
  • Changed navigationEnhancementCallbacks from direct assignment to a promise-based pattern
  • performEnhancedPageLoad now awaits the callbacks promise, ensuring they're available before use

Fixes #62540.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copy link
Contributor

Greetings human! You've submitted a PR that modifies code that is shared with https://github.com/dotnet/runtime . Please make sure you synchronize this code with the changes in that repo!

@github-actions github-actions bot added the needs-area-label Used by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically label Jul 2, 2025
@Copilot Copilot AI changed the title [WIP] Fix NotFoundSetOnFormSubmit_ResponseNotStarted_SSR test Fix NotFoundSetOnFormSubmit_ResponseNotStarted_SSR test and enhanced navigation timing issue Jul 2, 2025
@Copilot Copilot AI requested a review from ilonatommy July 2, 2025 13:52
Copilot finished work on behalf of ilonatommy July 2, 2025 13:52
…/else logic in NotFoundSetOnFormSubmit_ResponseNotStarted_SSR test

Co-authored-by: ilonatommy <[email protected]>
@Copilot Copilot AI requested a review from ilonatommy July 2, 2025 14:09
Copilot finished work on behalf of ilonatommy July 2, 2025 14:09
@ilonatommy ilonatommy requested a review from pavelsavara July 2, 2025 14:15
@ilonatommy ilonatommy added area-blazor Includes: Blazor, Razor Components and removed needs-area-label Used by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically labels Jul 2, 2025
@ilonatommy ilonatommy removed the request for review from pavelsavara July 3, 2025 08:26
@ilonatommy
Copy link
Member

The underlying issue should be fixed by #62524. This PR will only rename the test and double check if the missing test case is fine after the fix lands.

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 Attention: Shared Code Modified

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix NotFoundSetOnFormSubmit_ResponseNotStarted_SSR test

2 participants