Skip to content

Fix issue with Blazor state#4786

Merged
rockfordlhotka merged 7 commits into
mainfrom
dev/10-beta
Jan 8, 2026
Merged

Fix issue with Blazor state#4786
rockfordlhotka merged 7 commits into
mainfrom
dev/10-beta

Conversation

@rockfordlhotka

Copy link
Copy Markdown
Member

Fixes #4774

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request addresses issue #4774 by fixing Blazor state management behavior. The changes ensure that session state is properly tracked and persisted across both server-side and WebAssembly Blazor applications.

Key changes include:

  • Adding Touch() calls to mark sessions as updated when state changes occur in server-side Blazor
  • Refactoring constant names for context keys to improve maintainability
  • Converting SaveState() from async to synchronous by returning the Task directly
  • Upgrading sample applications to .NET 10 and updating package versions

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
Source/version.json Version bump to 10.0.0-beta.0021
Source/Csla.Blazor/State/StateManager.cs Refactored SaveState() method to return Task directly and added Touch() calls for server-side state persistence
Source/Csla.AspNetCore/Blazor/ApplicationContextManagerBlazor.cs Added session.Touch() calls when setting local and client context to ensure state changes are tracked
Source/Csla.Blazor.WebAssembly/ApplicationContextManager.cs Extracted magic strings to constants for context names
Samples/BlazorExample/Directory.Packages.props Updated package versions to 10.0.0 and CSLA version
Samples/BlazorExample (multiple .csproj files) Updated target framework from net9.0 to net10.0
Samples/BlazorExample/.../Program.cs Added server-side data portal configuration
Samples/BlazorExample/.../CslaStateController.cs Added using directive for Messages namespace
Samples/BlazorExample/.../Counter.razor Refactored to use RendererInfo, removed manual IsInteractive tracking, and added SaveState() call
Samples/BlazorExample/.../NavMenu.razor Whitespace formatting change
Samples/BlazorExample/.../App.razor Updated static asset references to use Assets helper

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Source/Csla.Blazor.WebAssembly/ApplicationContextManager.cs
Comment thread Source/Csla.Blazor.WebAssembly/ApplicationContextManager.cs
Comment thread Samples/BlazorExample/BlazorExample/BlazorExample/Components/Layout/NavMenu.razor Outdated
@rockfordlhotka rockfordlhotka merged commit 34b3127 into main Jan 8, 2026
2 checks passed
@rockfordlhotka rockfordlhotka deleted the dev/10-beta branch January 8, 2026 21:28
rockfordlhotka added a commit that referenced this pull request Jan 8, 2026
rockfordlhotka added a commit that referenced this pull request Jan 8, 2026
* Update beta version

* Update BlazorExample to net10.0 and csla 10

* #4774 Update state handling

* #4774 Diagnosing and fixing blazor context issue

* Update sample

* #4786 Fix package versioning

* Add claude settings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Preserving state in BlazorExample not working

2 participants