Skip to content

fix: escape toast dismissal IDs - #8018

Open
harsh21234i wants to merge 3 commits into
reflex-dev:mainfrom
harsh21234i:fix/8017-toast-dismiss-string-escaping
Open

harsh21234i wants to merge 3 commits into
reflex-dev:mainfrom
harsh21234i:fix/8017-toast-dismiss-string-escaping

Conversation

@harsh21234i

@harsh21234i harsh21234i commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #8017.

Serialize string IDs passed to rx.toast.dismiss as JSON string literals, escaping < so IDs containing Reflex interpolation markers remain opaque to Reflex's Var decoder. This supports quotes and newlines without generating invalid JavaScript or corrupting marker-like IDs.

Regression coverage asserts the complete generated function for apostrophes, double quotes, newlines, and a literal <reflex.Var>...</reflex.Var> ID.

Tests

  • tests/units/reflex_components_sonner/test_toast.py: 6 passed
  • git diff --check: passed

@harsh21234i
harsh21234i requested a review from a team as a code owner November 26, 2026 05:01
@FarhanAliRaza FarhanAliRaza added the bug Something isn't working label Nov 26, 2026 — with ChatGPT Codex Connector
@greptile-apps

greptile-apps Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · This PR appears safe to merge.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This PR appears safe to merge.

Summary

rx.toast.dismiss now safely quotes string IDs and escapes < so marker-like text stays unchanged.

  • Toast dismissal keeps string IDs intact in generated calls.

Reviews (3) · Last reviewed commit: "Format the toast dismissal regression te..." · Reviewed by Greptile

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 3 files

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

@codspeed

codspeed Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 17 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 146 untouched benchmarks
⏩ 8 skipped benchmarks1


Comparing harsh21234i:fix/8017-toast-dismiss-string-escaping (d1cc7ac) with main (6f5c39c)

Open in CodSpeed

Footnotes

  1. 8 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rx.toast.dismiss breaks for IDs containing quotes or newlines

2 participants