Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
put_toast(socket, :success, "Saved")is followed byput_flash(socket, :error, "Check the form")before the client clears the success flash, the error flash does not render. The sync branch stores the whole assigns map under:fbecause the nestedput_inexpression returns the root map.Use
Map.put(assigns[:f], sync_toast_kind, nil)to update the flash map. The error flash now renders. The success message remains a stream toast, and its duplicate flash stays hidden. The tests also check the exact component flash map and oneclear-flashevent per matching update.The change touches only
lib/live_toast/live_component.ex,demo/test/demo_web/live/send_toast_test.exs, andCHANGELOG.md. Stream insertion, toast counts, dismissal, the public API, and JavaScript remain unchanged.mainat1ef5300cd demo && mix test test/demo_web/live/send_toast_test.exsafter the fixcd demo && mix testmix format --check-formattedmix credo --strictat repository rootcd demo && mix credo --strict test/demo_web/live/send_toast_test.exsgit diff --checkBefore the fix, the regression output included:
After the fix:
Full suite: