jwx / aurelia-direct-router Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
The title attribute on the route configuration object, and title property inside of routeable components is being ignored. This means you cannot set meaningful titles for routes, relying on the component name instead.
We should be able to set the title on the route configuration object (like we could in Aurelia 1). We should also be able to set the title from within the component itself (static title =).
We should also have the ability to specify the title in the form or a callback function (think a product page where the product name is the title). Also think of translating properties, etc using Aurelia i18n.
The only way to set the title is to configure it using RouterConfiguration via the customize method and using the title property with a template string.
When I use configured routing (the app has @routes decorator) and navigate using normal links, when I use the browser's back button, I receive an exception from the Router.
The router should correctly navigate back or forward to the given URL.
The page stays and an exception is logged.
Uncaught (in promise) TypeError: t.instruction.replace is not a function
processNavigation index.js:3696
handleNavigatorNavigateEvent index.js:3658
publish index.js:1596
notifySubscribers index.js:2567
navigate index.js:2491
handleNavigatorStateChangeEvent index.js:3668
publish index.js:1596
notifySubscribers index.js:3274
handlePopStateEvent index.js:3268
execute index.js:3060
dequeue index.js:3085
enqueue index.js:3117
handlePopStateEvent index.js:3267
handleEvent index.js:3259
A bit nicer link to the relevant line:
I don't think the code really needs to set the navigation.path
, seems to work without it.
I am trying to create a single page admin interface and navigate between pages.
https://github.com/zenorbi/aurelia-direct-router-history-bug
Software | Version(s) |
---|---|
Aurelia | 2.0.0-alpha.22 |
Language | TypeScript 4.5.2 |
Browser | Firefox 94.0.1 |
Bundler | Webpack 5.64.1 |
Operating System | Windows 10 |
NPM/Node/Yarn | NPM 8.1.0 |
When creating a lifecycle hook using the lifecycleHooks decorator, you cannot access this
inside any of the methods such as canLoad.
Inside of lifecycle hooks, you should be able to use this, to reference the hook class instance. This is so you can inject things into the hook using dependency injection (auth services, etc). L
This is undefined. You can hack something together by accessing the view model, but this requires you to inject your dependency into every single routeable component.
Returning the router.load
function ends up not loading the route.
return this.router.load('someRoute'); //No worky
this.router.load('someRoute'); //Works fine
return;
The full controller
import { inject } from 'aurelia';
import { IRouter } from 'aurelia-direct-router';
@inject(IRouter)
public class SomeClass {
constructor(private router: IRouter) {}
attached() {
return this.router.load('someRoute'); //Does not load anything
//comment out one or the other
this.router.load('someRoute'); //Loads the route
return;
}
}
I would expect you to be able to have return on the same line.
return this.router.load('someRoute'); //Does not load anything
this.router.load('someRoute'); //Loads the route
return;
return this.router.load('someRoute'); //Should Work
return await this.router.load('someRoute'); //Should Work
Software | Version(s) |
---|---|
Aurelia | latest v2 |
Language | English |
Browser | Chrome |
Bundler | Webpack |
Operating System | W10 |
NPM/Node/Yarn | Npm |
Hash URLs don't work on page reload
The route is loaded
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)
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.
Software | Version(s) |
---|---|
Aurelia | 2.0.0-alpha.8 |
Aurelia Direct Router | 2.0.0-alpha.8.0 |
When aurelia-direct-router": "^2.0.0-alpha.8.0
is used with [email protected]
the app crashes
The app should load the configured route
The following exception is thrown
Uncaught (in promise) Error: No definition found for type HTMLElement
at Object.getDefinition (webpack-internal:///./node_modules/@aurelia/runtime-html/dist/esm/resources/custom-element.js:205)
at Function.forCustomElement (webpack-internal:///./node_modules/@aurelia/runtime-html/dist/esm/templating/controller.js:172)
at ViewportContent.contentController (webpack-internal:///./node_modules/aurelia-direct-router/dist/esm/endpoints/viewport-content.js:141)
at ViewportContent.createComponent (webpack-internal:///./node_modules/aurelia-direct-router/dist/esm/endpoints/viewport-content.js:187)
at Step.eval (webpack-internal:///./node_modules/aurelia-direct-router/dist/esm/endpoints/viewport.js:537)
at Function.process (webpack-internal:///./node_modules/aurelia-direct-router/dist/esm/utilities/runner.js:219)
at Function.run (webpack-internal:///./node_modules/aurelia-direct-router/dist/esm/utilities/runner.js:80)
at Viewport.transition (webpack-internal:///./node_modules/aurelia-direct-router/dist/esm/endpoints/viewport.js:502)
at NavigationCoordinator.addEndpoint (webpack-internal:///./node_modules/aurelia-direct-router/dist/esm/navigation-coordinator.js:154)
at Router.processNavigation (webpack-internal:///./node_modules/aurelia-direct-router/dist/esm/router.js:288)
Install and use aurelia-direct-router
in the default npx makes aurelia
project with routing
Software | Version(s) |
---|---|
Aurelia | 2.0.0-alpha.9 |
Language | Typescript |
When performing a fresh npx makes aurelia
and following the steps on https://jwx.gitbook.io/aurelia-direct-router/routing/configuration-and-setup the browsers shows a error when running npm start
Conflicting @aurelia/metadata module import detected. Please make sure you have the same version of all Aurelia packages in your dependency tree.
Sample steps
index.js?0987:505 Uncaught Error: Conflicting @aurelia/metadata module import detected. Please make sure you have the same version of all Aurelia packages in your dependency tree.
at applyMetadataPolyfill (index.js?0987:505)
at eval (di.js?f9c5:2)
at Module../node_modules/aurelia-direct-router/node_modules/@aurelia/kernel/dist/esm/di.js (entry.bundle.js:2153)
at __webpack_require__ (entry.bundle.js:3843)
at eval (platform.js:8)
at Module../node_modules/aurelia-direct-router/node_modules/@aurelia/kernel/dist/esm/platform.js (entry.bundle.js:2219)
at __webpack_require__ (entry.bundle.js:3843)
at eval (index.js:77)
at Module../node_modules/aurelia-direct-router/node_modules/@aurelia/kernel/dist/esm/index.js (entry.bundle.js:2186)
at __webpack_require__ (entry.bundle.js:3843)
Sample repo: https://github.com/eriklieben/router-dep-issue
Software | Version(s) |
---|---|
Aurelia | 2.0.0-alpha.6 |
Language | TS |
Browser | Edge Chromium |
Bundler | Webpack |
Operating System | Windows 10 |
NPM/Node/Yarn | Node v14.16.0, npm 6.14.11 |
Oddly enough, when you run through the wizard and select Do you want to install npm dependencies now? ยป No
and then perform npm i aurelia-direct-router
and npm install
everything works fine.
In some cases, not allowing navigation in canUnload
causes navigation to break.
All navigations involving canUnload
should work.
Navigation stops working.
Investigate and fix.
Lifecycle hooks are a great way to do auth guard checks and redirect users to other parts of your application using hooks such as canLoad.
You should be able to return a component from inside of canLoad like you can in the core router.
The component name as a string needs to be returned, which I believe is more difficult to test and flaky.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.