Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Sub-pages like [id]/foo.html cannot navigate back to [id].html #532

Closed
nolanlawson opened this issue Dec 11, 2018 · 4 comments
Closed

Sub-pages like [id]/foo.html cannot navigate back to [id].html #532

nolanlawson opened this issue Dec 11, 2018 · 4 comments
Labels

Comments

@nolanlawson
Copy link
Contributor

If you have a page structure like:

/accounts/[accountId].html
/accounts/[accountId]/foo.html

Then if you navigate from the first to the second, then press the back button in the browser, Sapper will not actually render the first page. It will just stay stuck on the second page.

I wrote a minimal repro using sapper-template. Steps to repro:

git clone https://github.com/nolanlawson/sapper-template.git \
  --branch demo-sapper-sub-page-bug \
  --depth 1 \
  --single-branch
cd sapper-template
npm i
npm run dev

Then in a browser, open localhost:3000, click on "Account # 1", then click on "my sub-page", then click the back button.

Expected result: it navigates back.

Actual result: the URL changes, but it does not navigate back.

@nolanlawson
Copy link
Contributor Author

It seems you can fix this by using [accountId]/index.html instead of [accountId].html, but it's a bit counter-intuitive that they would work differently.

@Conduitry
Copy link
Member

Conduitry commented Dec 11, 2018

The branch is using Sapper 0.22.10, but this looks to also be present in the latest 0.24.1.

It also looks like this is not specific to navigating back - if you click the 'Account # 1' in the header, while on the subpage, the same thing happens - the URL updates, the page does not.

@Conduitry Conduitry added the bug label Dec 11, 2018
@cudr
Copy link
Contributor

cudr commented Dec 18, 2018

Have same problem on Edge browser in production mode

@Rich-Harris
Copy link
Member

This is fixed in 0.25 thanks to @cudr

Seb35 added a commit to Legilibre/archeo-lex.fr that referenced this issue Mar 9, 2019
When you were in /eli/code/code_civil and clicked on the nav to return
to /eli/code, the URL changed but not the content of the page (the
hydratation inside Sapper had a bug).

Bug: sveltejs/sapper#532
PR: sveltejs/sapper#539

Thanks to cudr@github.com!
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants