Enter/leave the app (back button issue)
- Dominant language
- JavaScript
- Stars
- 6.8k
- Forks
- 573
- PR merge metrics
- No merged PRs in 30d
Description
My app works server-rendered without javascript.
My app works properly when clicking links within app routes.
```javascript
const app = choo()
app.route('/view/:image', detail) // <-- page with an image
// /small/image.jpg <-- static image served by nginx
app.route('/', main) // <-- index page with grid of images
```
The problem I am having seems to be navigating in and out of the app to other sites or static files:
### Steps to reproduce behavior
If I start at the index route `/`, then navigate via an `` to another route of the app—`/view/image.jpg`—then click another `` link, taking me to a static original file `/static/image.jpg` that's served from my static server I get unexpected behavior:
### Expected behavior
I expect that clicking the back button goes back to `/view/image.jpg`.
### Actual behavior
But actually clicking the back button goes to `/`.
It seems like my browser history has no knowledge of what happened when I was using Choo, and I'm sure the solution is something simple, but I've really struggled understanding what the intended approach to building apps with Choo is because there aren't many examples out there. I've found out I was doing too much with state/events, and needed to use routes and pages more, and that's taken me to this point.
Contributor guide
Research direction
Reproduce the sequence from `/` to `/view/image.jpg`, then to `/static/image.jpg`, and inspect the browser history after each navigation. Compare the Choo route links with the static-file link; the fix is complete when the back button from the static image returns to `/view/image.jpg` rather than `/`.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100