Skip to content

[MT-23014] Show a friendly state for deleted open messages#42

Merged
kyrylo-yevdokymov merged 2 commits into
mainfrom
fix/mt-23014-deleted-message-state
Jul 14, 2026
Merged

[MT-23014] Show a friendly state for deleted open messages#42
kyrylo-yevdokymov merged 2 commits into
mainfrom
fix/mt-23014-deleted-message-state

Conversation

@kyrylo-yevdokymov

@kyrylo-yevdokymov kyrylo-yevdokymov commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

What & why

Fixes MT-23014, a sub-task of MT-22849.

Message API 404s were handled as generic Axios failures, and an externally deleted open message remained stale. This change recognizes the not-found case, reacts to live deletion, and renders a clear recovery state with a route back to the inbox.

Impact

Users no longer see a raw network error when the open message has been deleted.

Screenshots

Before After

Verification

  • npm test — 62 tests passed
  • npm run lint — 0 errors; 4 existing warnings
  • npm run build — passed
  • git diff --check main...fix/mt-23014-deleted-message-state — passed

Summary by CodeRabbit

  • New Features

    • Added a clear deleted-message state when an opened message is no longer available.
    • Added a “Back to inbox” action from the deleted-message view.
    • The view now updates immediately when a message is deleted while open.
  • Bug Fixes

    • Improved error handling so missing messages show a friendly notice instead of technical error details.
    • Other loading failures continue to display an appropriate error message.

A message deleted while open (by another client, the API, or retention
eviction) surfaced as the raw axios string "Error: AxiosError: Request
failed with status code 404" in MessageView.

- Add isNotFoundError() to api/client next to isAbortError.
- On a 404 load, render an EmptyCard saying the message was deleted,
  with a "Back to inbox" button instead of the raw error.
- Subscribe MessageView to the live channel and swap to the same
  deleted state when a 'destroyed' frame targets the open message,
  instead of leaving a stale view.
- Non-404 failures now go through extractApiError() for readable copy.

Jira: MT-22849 (finding 8)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e53003ce-c1d4-44f2-8b81-8ffd4eb77568

📥 Commits

Reviewing files that changed from the base of the PR and between fb39e2b and 1ab8427.

📒 Files selected for processing (3)
  • frontend/src/api/client.ts
  • frontend/src/pages/MessageView.test.tsx
  • frontend/src/pages/MessageView.tsx

📝 Walkthrough

Walkthrough

MessageView now distinguishes deleted messages from other load failures. It renders a deleted state for 404 responses or matching live destroyed frames, supports returning to the inbox, and adds coverage for these behaviors.

Changes

Message deletion handling

Layer / File(s) Summary
Not-found error detection
frontend/src/api/client.ts
Adds an exported helper that identifies Axios responses with HTTP status 404.
Deleted message view state
frontend/src/pages/MessageView.tsx
Tracks deletion state, handles 404 loads and matching live deletion frames, resets state when the message changes, and renders deleted or generic error views.
Deleted-state test coverage
frontend/src/pages/MessageView.test.tsx
Tests 404 rendering, inbox navigation, non-404 failures, and matching versus unrelated live deletion frames.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: sergeykorolev

Sequence Diagram(s)

sequenceDiagram
  participant MessageView
  participant MessagesAPI
  participant useMessagesChannel
  participant InboxNavigation
  MessagesAPI->>MessageView: message load response or 404 error
  useMessagesChannel->>MessageView: destroyed frame with message ID
  MessageView->>MessageView: set deleted state for matching message
  MessageView->>InboxNavigation: navigate back to inbox
Loading
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kyrylo-yevdokymov

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@kyrylo-yevdokymov
kyrylo-yevdokymov marked this pull request as ready for review July 13, 2026 10:43

@roman-adamchik roman-adamchik 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.

lgtm

@kyrylo-yevdokymov
kyrylo-yevdokymov merged commit 4c8f262 into main Jul 14, 2026
4 of 5 checks passed
@kyrylo-yevdokymov
kyrylo-yevdokymov deleted the fix/mt-23014-deleted-message-state branch July 14, 2026 15:25
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.

4 participants