Repository navigation
Fix TempData and SupplyParameterFromSession persistence for streaming SSR case #66832
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
Merged
dariatiurina
merged 22 commits into
dotnet:main
from
dariatiurina:66745-streamingssr-tempdata-sessiondata
Jun 16, 2026
Merged
Changes from 8 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
1acf121
Fix OnStarting for streaming SSR case
dariatiurina 376d91c
Clean-up
dariatiurina ee4ce7e
Fix
dariatiurina 3fffa0c
Merge branch '66745-streamingssr-tempdata-sessiondata' of https://git…
dariatiurina 27c8524
TempData fix
dariatiurina b8da91a
Fix tests
dariatiurina 0bc4de3
Fix TempData case
dariatiurina 16a6e52
Fix clean-up
dariatiurina e43b92a
Feedback on tests
dariatiurina cc816f9
Applied feedbacks
dariatiurina 18d36f6
Feedback
dariatiurina 29d04cf
Clean-up
dariatiurina 42664d8
Merge branch 'main' into 66745-streamingssr-tempdata-sessiondata
dariatiurina 295808b
Fix warning
dariatiurina fb4827f
Clean-up
dariatiurina fef336d
Fix logging
dariatiurina 346eaa4
Add testing
dariatiurina 7fe1b48
Improve logging message
dariatiurina c194ae4
Upgrade logging
dariatiurina cda1185
Improve null session warning
dariatiurina 315c172
Improve null session warning
dariatiurina 1c27423
Fixed test
dariatiurina File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
src/Components/test/E2ETest/ServerRenderingTests/StreamingSessionPersistenceTest.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using Components.TestServer.RazorComponents; | ||
| using Microsoft.AspNetCore.Components.E2ETest.Infrastructure; | ||
| using Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures; | ||
| using Microsoft.AspNetCore.E2ETesting; | ||
| using OpenQA.Selenium; | ||
| using TestServer; | ||
| using Xunit.Abstractions; | ||
|
|
||
| namespace Microsoft.AspNetCore.Components.E2ETests; | ||
|
|
||
| public class StreamingSessionPersistenceTest : ServerTestBase<BasicTestAppServerSiteFixture<RazorComponentEndpointsNoInteractivityStartup<App>>> | ||
| { | ||
| private const string SessionCookieName = ".AspNetCore.Session"; | ||
|
|
||
| public StreamingSessionPersistenceTest( | ||
| BrowserFixture browserFixture, | ||
| BasicTestAppServerSiteFixture<RazorComponentEndpointsNoInteractivityStartup<App>> serverFixture, | ||
| ITestOutputHelper output) | ||
| : base(browserFixture, serverFixture, output) | ||
| { | ||
| } | ||
|
|
||
| protected override void InitializeAsyncCore() | ||
| { | ||
| _serverFixture.AdditionalArguments.Add("--UseSessionStorageTempDataProvider=true"); | ||
|
dariatiurina marked this conversation as resolved.
Resolved
|
||
| _serverFixture.AdditionalArguments.Add("--UseSession=true"); | ||
| Browser.Manage().Cookies.DeleteCookieNamed(SessionCookieName); | ||
| base.InitializeAsyncCore(); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void StreamingSSR_PersistsSupplyParameterFromSession_AfterAsyncRendering() | ||
| { | ||
| Navigate($"{ServerPathBase}/streaming-session-persistence"); | ||
|
|
||
| // Wait for streaming to complete — values are set AFTER an await in OnInitializedAsync | ||
| Browser.Exists(By.Id("streaming-complete")); | ||
| Browser.Equal("set-during-streaming", () => Browser.FindElement(By.Id("session-value")).Text); | ||
|
|
||
| // Navigate to the read page with a full page load to verify the value survived the request boundary | ||
| Navigate($"{ServerPathBase}/streaming-session-persistence/read"); | ||
| Browser.Equal("set-during-streaming", () => Browser.FindElement(By.Id("read-session-value")).Text); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void StreamingSSR_PersistsSupplyParameterFromTempData_AfterAsyncRendering() | ||
| { | ||
| Navigate($"{ServerPathBase}/streaming-session-persistence"); | ||
|
|
||
| // Wait for streaming to complete | ||
| Browser.Exists(By.Id("streaming-complete")); | ||
| Browser.Equal("tempdata-set-during-streaming", () => Browser.FindElement(By.Id("tempdata-value")).Text); | ||
|
|
||
| // Navigate to the read page to verify TempData was persisted via session storage | ||
| Navigate($"{ServerPathBase}/streaming-session-persistence/read"); | ||
| Browser.Equal("tempdata-set-during-streaming", () => Browser.FindElement(By.Id("read-tempdata-supply-value")).Text); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void StreamingSSR_PersistsTempDataCascadingParameter_AfterAsyncRendering() | ||
| { | ||
| Navigate($"{ServerPathBase}/streaming-session-persistence"); | ||
|
|
||
| // Wait for streaming to complete | ||
| Browser.Exists(By.Id("streaming-complete")); | ||
|
|
||
| // Navigate to the read page to verify ITempData values set during streaming were persisted | ||
| Navigate($"{ServerPathBase}/streaming-session-persistence/read"); | ||
| Browser.Equal("streaming-tempdata-message", () => Browser.FindElement(By.Id("read-tempdata-message")).Text); | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.