Fix: preserve custom onFail callback in UniversalRoutes::bootstrap()#1471
Fix: preserve custom onFail callback in UniversalRoutes::bootstrap()#1471JeremyRed wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thanks for the PR. Unfortunately we don't intend on making these sorts of changes to v3 when v4 (with the issue addressed and the whole feature later implemented differently) will be released shortly, see #1470 (comment) |
|
Thanks for taking a look, and for the quick response. I know v4 has been in development for a while now, figured a small, low-risk patch might still be worth having but completely understand not wanting to carry changes forward that'll be superseded soon anyway. Thanks again for maintaining the package, we'll keep an eye out for v4! |
Fixes #1470
This is a small, low-risk fix for the issue linked above, happy to adjust the approach if you'd prefer to solve it differently, but since the change is minimal and the impact felt high-value, I thought it was worth putting together as a starting point.
What this changes
UniversalRoutes::bootstrap() currently overwrites $onFail on both identification middlewares unconditionally, discarding any custom callback the application had set. This PR captures the existing callback before overwriting it, and falls back to it (instead of throwing) when the UniversalRoutes bypass check doesn't apply.
We've tested this against our own setup and confirmed it resolves the behaviour described in #1470. Open to feedback if you'd rather handle this differently (e.g. scoping it to v3 only given the v4/main split).