beamer
beamer copied to clipboard
Nested router resets (?) causes "flickering" (not found tab appearing)
Describe the bug
tl&dr: I'm seeing a "not found" tab for a quick second, for the 1st time, instead of the expected route.
In the reproducible app that follow, ther are 2 flows:
- initialPath is /articles -> go to /article/:id -> click back
- initialPath is /books -> go to /articles -> go to /article/:id -> click back
On the 1st everything seems fine. On the 2nd, we can see there's a "not found" page in between, probably for the nested. It only happens in this flow, and only for the 1st time.
Flow #1 / Articles start - which works well:
https://github.com/slovnicki/beamer/assets/5613042/86f75d4e-f0f8-4b07-b4cc-960958f8381d
Flow #2 / books start - where we can see the issue:
https://github.com/slovnicki/beamer/assets/5613042/5a809872-fce6-4fdd-b0c4-ec14b143de31
Beamer version: (e.g. v0.14.1
, master
, ...)
v1.5.5
To Reproduce Steps to reproduce the behavior:
- Go to https://github.com/matanshukry/case325 , and clone the repo
- Go to
my_app.dart
, and changeinitialPath
to/books
(Flow #2). - Start the app
- Click on the "books" tab (the right one)
- Click on one of the items
- Issue: at this point while transitioning, if you use time dilation for example, you should see a "not found" page for a brief second.
- Click back (android back button)
- Issue: at this point while transitioning, if you use time dilation for example, you should see a "not found" page for a brief second.
To clarify, if you do the same flow without restarting the app - there is no "not found" page. It seems to only happen for the 1st time.
Expected behavior The routes should be shown without a "not found" in betweem them.
Screenshots Added videos before, should be enough.
Desktop (please complete the following information):
- OS: N/a
- Browser: N/A
- Version: N/A
Smartphone (please complete the following information):
- Device: Android simulator
- OS: Pixel 6 API 30
- Browser N/A, but stock browser probably
- Version: API 30
Additional context Add any other context about the problem here.
I'm facing a similar issue too. It looks like this happens when you nest beamers. When try to navigate to a route which is handled by a BeamLocation
in the parent beamer from the inner beamer, the inner beamer's BeamLocation
s also try to resolve the route, which ends up failing.
example:
-
RootLocation
consists of two paths, /books and /articles -
BooksLocation
consists of a path, /books/:id
There are two nested beamers, where the outer beamer uses RootLocation
and the inner beamer uses BooksLocation
. When you are in, say, /books/123 and try to navigate to /articles, both BooksLocation
and RootLocation
try to resolve /articles. It succeeds in RootLocation
but fails in BooksLocation
.
In my case, this happens all the time when i try to navigate from an inner beamer, not just once. For now, I managed to side step the issue by returning a BeamPage
whose child is a SizedBox.shrink
in the inner BeamLocation. There are no errors (or the not found page) and the widget tree as seen via the dev tools seems to be fine too.