Fix toast notifications not displaying immediately on login/register screens #1
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.
Problem
Toast notifications were not appearing immediately when validation failed on login and register screens. Users would click the login button with empty password, but the toast would only appear after navigating to another screen (like clicking the register button).
Root Cause
The issue was caused by timing problems in the Minecraft rendering pipeline. Toast calls made directly in button event handlers (
UtilToast.toast()) were added to Minecraft's toast manager but not processed until the next screen refresh cycle.Solution
Wrapped all immediate toast calls in
ctx.get().enqueueWork{}blocks to ensure they execute in the proper render cycle timing. This follows the same pattern already used successfully inPacketResponse.handle()for network-triggered toasts.Changes Made
Before:
After:
Applied to:
Expected Behavior
After this fix:
Testing
The fix follows the established pattern used by
PacketResponse.handle()which successfully displays toasts for network responses, ensuring consistency with existing working code.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
mirrors.cloud.tencent.com/usr/lib/jvm/temurin-17-jdk-amd64/bin/java -Xmx64m -Xms64m -Dorg.gradle.appname=gradlew -classpath /home/REDACTED/work/AsyncAuth/AsyncAuth/gradle/wrapper/gradle-wrapper.jar org.gradle.wrapper.GradleWrapperMain projects(dns block)If you need me to access, download, or install something from one of these locations, you can either:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.