Skip to content

FE-1651: Keep a notification without detail a single compact line - #9631

Merged
kube merged 2 commits into
mainfrom
claude/fe-1651-compact-notification-toast
Sep 9, 2026
Merged

FE-1651: Keep a notification without detail a single compact line#9631
kube merged 2 commits into
mainfrom
claude/fe-1651-compact-notification-toast

Conversation

@kube

@kube kube commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Before this PR, every notification carried the chrome a long error needs. #9564 gave the toaster a description column, a copy button and a close button so an AI assistant failure could be read and copied from the toast, and applied that shape to all of them. A three-second message with no detail, "Simulation complete" among them, rendered as a tall pill: title top-aligned in a column, close button beside it.

A notification without detail is a single centred line again, with no buttons, the form it had before. One that carries detail keeps the column, the copy button and the close button, and so does an error, which never dismisses itself.

Links

Changes

  • A notification's buttons appear only where it needs a way out

    An error stays open until dismissed and a detail is there to be read, so both keep copy and close. A plain message clears itself after three seconds.

  • The toast centres its row unless it carries detail

    data-detail on the toast root drives the alignment, so a title with a description still lines up with the top of the buttons beside it.

Test coverage

  • provider.test.tsx:

    A message with no detail renders no close or copy button and no data-detail; an error with detail renders both and carries the attribute.
    Queries read from each toast's own root, since the toaster is a module singleton whose toasts outlive a test.

  • Built stylesheet:

    Carries align-items: center for the toast root and align-items: flex-start only under [data-detail].

How to test

  • Open Petrinaut preview on Vercel
  • Menu > Load example > any model
  • Switch to Simulate
  • Create an experiment with a couple of runs and wait for it to finish

    Expect a single-line dark toast in the bottom right, no buttons, gone after three seconds

  • Ask the AI assistant something while the assistant is unreachable

    Expect the error toast to keep its wrapped title, Copy details and Close, and to stay until closed

@kube kube self-assigned this Sep 9, 2026
@vercel

vercel Bot commented Sep 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hash Ready Ready Preview Sep 9, 2026 1:59pm UTC
petrinaut Ready Ready Preview Sep 9, 2026 1:59pm UTC
2 Skipped Deployments
Project Deployment Actions Updated
hashdotdesign-tokens Ignored Ignored Preview Sep 9, 2026 1:59pm UTC
petrinaut-docs Ignored Ignored Preview Sep 9, 2026 1:59pm UTC

Request Review

@github-actions github-actions Bot added area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team labels Sep 9, 2026
@github-actions github-actions Bot removed the area/infra Relates to version control, CI, CD or IaC (area) label Sep 9, 2026
@kube
kube marked this pull request as ready for review September 9, 2026 13:49
Copilot AI balanced review requested due to automatic review settings September 9, 2026 13:49
@cursor

cursor Bot commented Sep 9, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Scoped UI change to Petrinaut notification toasts with test coverage; no auth, data, or API impact.

Overview
Plain notifications (no detail, non-error) render as a single centered line again: no close or copy controls, and they still auto-dismiss after the default duration.

Toasts that need a way out keep the action column: anything with detail gets copy + close, and error toasts always get close (even without detail) because they stay until dismissed. The toast root sets data-detail when a description is present so layout uses centered alignment by default and top-aligns content only when detail is shown.

Adds a provider test that asserts button/data-detail presence per toast type, querying each toast root to avoid interference from the module singleton toaster.

Reviewed by Cursor Bugbot for commit 7a7ab75. Bugbot is set up for automated code reviews on this repo. Configure here.

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.

🟡 Changes recommended

The new detail/dismissible/data-detail logic is inconsistent when detail is an empty string, producing a “detail” layout/state without rendering the description/copy button.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adjusts Petrinaut’s toast notification rendering so “plain” messages (no detail) return to a compact, single-line appearance with no action buttons, while detailed and error notifications retain the expanded layout and affordances.

Changes:

  • Center-align toast content by default, switching to top alignment only when the toast carries detail (via a data-detail attribute).
  • Show close/copy actions only for notifications that are errors or that include detail.
  • Add a unit test asserting button/attribute presence for plain vs detailed error notifications.
File summaries
File Description
libs/@hashintel/petrinaut/src/react/notifications/toaster.tsx Updates toast layout/alignment and conditionally renders action buttons based on presence of detail or error type.
libs/@hashintel/petrinaut/src/react/notifications/provider.test.tsx Adds coverage for “no detail => no buttons/attribute” and “error with detail => buttons + attribute”.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread libs/@hashintel/petrinaut/src/react/notifications/toaster.tsx
@kube
kube added this pull request to the merge queue Sep 9, 2026
Merged via the queue into main with commit 3703af7 Sep 9, 2026
62 checks passed
@kube
kube deleted the claude/fe-1651-compact-notification-toast branch September 9, 2026 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

3 participants