fix(mock): fire onDismiss/onClose callbacks in BottomSheetModal and BottomSheet - #2714
Open
LucasWerey wants to merge 1 commit into
Open
fix(mock): fire onDismiss/onClose callbacks in BottomSheetModal and BottomSheet#2714LucasWerey wants to merge 1 commit into
LucasWerey wants to merge 1 commit into
Conversation
…ottomSheet dismiss(), close(), and forceClose() in the mock silently drop their respective onDismiss/onClose props. Any component that relies on these callbacks for cleanup (e.g. queued drawer systems) silently hangs in tests — queue entries stay stuck in a 'dismissing' state and block subsequent sheets from opening. Fix: call this.props?.onDismiss?.() in dismiss(), and this.props?.onClose?.() in close()/forceClose() for both BottomSheetModal and BottomSheet.
3 tasks
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.
Problem
BottomSheetModal.dismiss(),BottomSheetModal.close(),BottomSheetModal.forceClose(),BottomSheet.close(), andBottomSheet.forceClose()inmock.jssilently drop their respectiveonDismiss/onCloseprops.Any component that relies on these callbacks for cleanup — e.g. queued drawer systems that need
onDismissto dequeue a sheet — will silently hang in tests: the queue entry stays stuck in a"dismissing"state and blocks subsequent sheets from opening.This forces consumers to patch the mock themselves on a per-test basis, which is fragile and obscures the real issue.
Reproduction
Fix
Call
this.props?.onDismiss?.()indismiss(), andthis.props?.onClose?.()inclose()/forceClose()for bothBottomSheetModalandBottomSheet.dismiss() { this.data = null; + this.props?.onDismiss?.(); } close() { this.data = null; + this.props?.onClose?.(); } forceClose() { this.data = null; + this.props?.onClose?.(); }