Problem with F5

image

Hi all,

When i press F5 my routing doesn’t work.
Do you know the problem?

Thanks for the help :smiley:
Andrea

You need to setup you web server to redirect 404 to the index page

do you have push state enabled? or are you missing a # in the url?

Thanks for the aswers :smiley:

@avrahamcool have the “config.options.pushState” set to true but I don’t think that this is the problem… the routing works, only when I press F5 the app doesn’t work.

@MaximBalaganskiy mmm, I have found a simple project and I’m editing it from VisualStudio Code so I can’t edit my server redirect, or for the moment I don’t know how to do it. If you would like to do a check I could zip a simple version of it.

Thansk for the help.

that might be a problem of activationStrategy.

when you reload the same route, aurelia will use the currently available VM and just call “activate” on it.
so - if you have logic that runs in “attached” it will not run again - and it will look like the page is not working.
if you reload twice - aurelia “knows” it need to recreate the VM - and then thing “works”.

to get around this problem, you an set the activationStrategy.replace on your route (or in your VM) - check out aurelia documentaion for the details.

or better yet: use the activate lifycycle to act on the reloads.

1 Like

For webpack dev server see aurelia-mdc-web/webpack.config.js at 68c01ffc1aae514668e4629b2625bd6f868bf67d · aurelia-ui-toolkits/aurelia-mdc-web · GitHub

For other bundlers I can’t tell