Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toast container duplication fix #657

Merged
merged 3 commits into from
Feb 24, 2025
Merged

Toast container duplication fix #657

merged 3 commits into from
Feb 24, 2025

Conversation

curtis-allan
Copy link
Contributor


name: Pull Request
about: Fix for duplicate toast containers
title: '[PR] '
labels: ''
assignees: ''


Related Issue
Mentioned in the FastHTML discord by user 78wesley and validated locally.

Proposed Changes
Toast containers were being spawned in overlapping contexts and thus rendering incorrectly when using multiple add_toast methods.

I've been through the gist provided by 78wesley in the discord, and it did indeed fix the issue. I've done a cleanup/ revamp of the toaster.py file to fix the issues, and also removed the javascript in favour of htmx.

Types of changes
What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist
Go over all the following points, and put an x in all the boxes that apply:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I am aware that this is an nbdev project, and I have edited, cleaned, and synced the source notebooks instead of editing .py or .md files directly.

Demo

toast_fix_final.mp4

@curtis-allan curtis-allan requested a review from jph00 February 21, 2025 08:21
@jph00
Copy link
Contributor

jph00 commented Feb 24, 2025

Excellent!

@jph00 jph00 merged commit 0208e86 into main Feb 24, 2025
2 checks passed
@jph00 jph00 deleted the toast_fix branch February 24, 2025 02:46
@jph00 jph00 added the bug Something isn't working label Mar 1, 2025
@78wesley
Copy link

78wesley commented Mar 2, 2025

Great job! Here I am also called @78wesley :D

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.

3 participants