Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Hash URLs don't work on page reload #16

Open
MaximBalaganskiy opened this issue Jun 27, 2021 · 5 comments
Open

Hash URLs don't work on page reload #16

MaximBalaganskiy opened this issue Jun 27, 2021 · 5 comments

Comments

@MaximBalaganskiy
Copy link

MaximBalaganskiy commented Jun 27, 2021

🐛 Bug Report

Hash URLs don't work on page reload

🤔 Expected Behavior

The route is loaded

😯 Current Behavior

An error is thrown

Uncaught (in promise) Error: 'button' did not match any configured route or registered component name - did you forget to add the component 'button' to the dependencies or to register it as a global dependency?
    at ViewportContent.createComponent (viewport-content.js?e63b:166)
    at Step.eval (viewport.js?918b:531)
    at Function.process (runner.js?fe99:213)
    at Function.run (runner.js?fe99:74)
    at Viewport.transition (viewport.js?918b:496)
    at NavigationCoordinator.run (navigation-coordinator.js?4b25:112)
    at Router.processNavigation (router.js?aa4b:309)

🔦 Context

Loading the app root and navigating to the route works fine.
Probably related - setting default route on au-viewport causes the same error, both on root viewport and on child viewports.

🌍 Your Environment

Software Version(s)
Aurelia 2.0.0-alpha.8
Aurelia Direct Router 2.0.0-alpha.8.0
@jwx
Copy link
Owner

jwx commented Jun 27, 2021

@MaximBalaganskiy Are you using a configured route? Are you only getting this with hash URLs?

@MaximBalaganskiy
Copy link
Author

Yes, configured routes. Haven't tried non-hashed.
When I looked at it last time several weeks ago it worked with non-hash.

@jwx
Copy link
Owner

jwx commented Jun 27, 2021

@MaximBalaganskiy If you could share the route config I can take a look at this late tonight or tomorrow. (I'm now off to celebrate my birthday.) I hope it's not blocking you.

@MaximBalaganskiy
Copy link
Author

import { IRouteViewModel } from "aurelia";
import { routes } from "aurelia-direct-router";
import { ButtonPage } from "./button-page";
import { CardPage } from "./card-page";
import { ExamplesPage } from "./examples-page";

@routes([
    { path: 'button', component: ButtonPage },
    { path: 'card', component: CardPage }
])
export class MyApp implements IRouteViewModel {
}

@MaximBalaganskiy
Copy link
Author

Just checked that the same happens with no-hash

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants