Posts

Your Blazor State Might Belong in the URL

Image
  When building a Blazor component, storing UI state directly inside class fields is the default instinct: C# private string ? searchText; private string ? status; private string sortColumn = "Name" ; private int page = 1 ; There’s nothing inherently broken about this. But think about the user experience. A user spends three minutes filtering down a customer list: they search for "Microsoft" , filter by Active , sort by LastContact , and jump to page 3 . Their screen shows a precise slice of data. Yet, their browser address bar still stubbornly reads: /customers If they refresh, their work is wiped out. If they bookmark the page, they lose the context. If they drop that link into Teams or Slack for a colleague, the recipient lands on page 1 of an unfiltered list. Compare that to: /customers?search=Microsoft&status=Active&sort=LastContact&page=3 By shifting page-level view parameters into query strings, the URL becomes a deterministic blueprint of ...

Mixed Render Modes in Blazor: Stop Making Your Entire App Interactive

Image
  For years, the first choice you made in a Blazor project set the course for your entire architecture: "This is a Blazor Server app." "This is a Blazor WebAssembly app." That single binary choice locked down your deployment, your hosting costs, and your state management across every single screen. Modern Blazor Web Apps removed that constraint. Within a single application, you can mix static server-rendered pages, server-side interactive circuits, and client-side WebAssembly components. You can even host multiple rendering models on the exact same page. Yet, many teams still build apps as if it's 2020. They slap @rendermode InteractiveServer onto their root Routes component and call it a day. Making everything interactive by default introduces unnecessary complexity, persistent SignalR circuit overhead, bloated WASM downloads, and elevated server memory usage. A far more practical strategy is to start static by default, then drop in interactivity only where t...