Skip to content

fix(ui): redirect to /blog when post not found in Edit page (null-value stuck loading) #307

Description

@mpaulosky

Problem

When GetBlogPostByIdQuery returns Result.Ok<BlogPostDto?>(null) (post doesn't exist), Edit.razor's OnParametersSetAsync sets _model = null and leaves _error as null. The template's @if (_model is null && _error is null) then renders 'Loading...' indefinitely.

This bug was identified in the Copilot review of PR #304 but the PR was merged before it was addressed.

Fix

Change the null-value branch from _model = null to Navigation.NavigateTo("/blog"); return;, matching the non-owner/non-admin redirect pattern.

Acceptance

  • Edit.razor redirects to /blog when post is not found
  • bUnit test EditRedirectsToBlogWhenPostNotFound passes

Metadata

Metadata

Assignees

No one assigned

    Labels

    squad:ralphAssigned to Ralph (Meta)type:bugSomething broken

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions