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.
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.
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.
Have same problem on Edge browser in production mode
This is fixed in 0.25 thanks to @cudr
Most helpful comment
This is fixed in 0.25 thanks to @cudr