beamer
beamer copied to clipboard
Data not passed to BeamGuard onCheckFailed.
Describe the bug
I have data that I'm passing to my HomeLocation()
. When a BeamGuard
checks requirements, fails, and runs onCheckFailed
, the location data
originally passed is not present in location.data
.
Beamer version: 1.5.3
To Reproduce
Add BeamGuard
to delegate.
BeamGuard(
pathPatterns: ['/auth'],
guardNonMatching: true,
check: (_, __) => read(authenticatedProvider),
onCheckFailed: (context, location) {
print(location.data);
return context.beamToNamed('/auth', data: location.data);
},
),
Try to beam to a guarded page.
context.beamToNamed('/', data: {'myData': 'testData'});
The route is successfully intercepted, the location
is the HomeLocation()
as expected, but the location.data
object is null, so it can't be passed on to the redirected page.
Expected behavior
location.data
in the onCheckFailed
function to have the data passed in the original beamToNamed
call.
I noticed that the data in also null within the check
callback
Hey @calebvetter :wave: Thanks for creating an issue and sorry for my absence lately.
This sounds like a bug, indeed. I will investigate it over the weekend and push a fix. Thanks for the additional feedback @tapizquent