fix(dismissable-layer): guard isTopMostLayer against empty layers array#650
fix(dismissable-layer): guard isTopMostLayer against empty layers array#650EduardF1 wants to merge 2 commits into
Conversation
👷 Deploy request for kobalte pending review.Visit the deploys page to approve it
|
|
Thanks for the fix! Will get this for release this week. |
SummaryAdds a one-line defensive guard to Status
@jer3m01 happy to rebase or adjust the guard/test placement if needed. Thanks! |
|
Thanks @jer3m01, appreciate it. If it helps before release, I can also add a tiny regression test around the empty-stack case, but I kept the patch minimal since the fix is just the defensive length guard. |
|
@jer3m01 friendly check-in on the release timing for this. If a patch-version bump or a CHANGELOG entry would help unblock cutting it, happy to push that in a follow-up commit. |
|
Hi team, gentle ping — CI is green and the change is small. Would appreciate a review when you get a chance! 🙏 |
|
Hi team, checking in on this PR! Let me know if you have any questions. |
Problem
isTopMostLayercrashes with TypeError when layers array is empty.Root cause
layers[layers.length - 1].nodethrows whenlayersis empty, sincelayers[-1]is undefined. Can happen during teardown or before a layer is registered.Fix
Add a length guard: