beamer icon indicating copy to clipboard operation
beamer copied to clipboard

Data not passed to BeamGuard onCheckFailed.

Open calebvetter opened this issue 2 years ago • 2 comments

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.

calebvetter avatar Feb 22 '23 19:02 calebvetter

I noticed that the data in also null within the check callback

tapizquent avatar Mar 13 '23 23:03 tapizquent

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

slovnicki avatar Jun 03 '23 17:06 slovnicki