Git Product home page Git Product logo

aurelia-direct-router's People

Contributors

3cp avatar bbosman avatar ben-girardet avatar bigopon avatar brandonseydel avatar dannybies avatar davismj avatar dependabot[bot] avatar eisenbergeffect avatar fkleuver avatar freshcutdevelopment avatar ghiscoding avatar gkaganas-mparticle avatar jwx avatar leon0824 avatar maximbalaganskiy avatar praveengandhi avatar rajansen avatar redfeet avatar renovate-bot avatar rluba avatar romkevdmeulen avatar sayan751 avatar seebiscuit avatar shahabganji avatar thephoenixofthevoid avatar timfish avatar vheissu avatar xenoterracide avatar zewa666 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

aurelia-direct-router's Issues

Cannot set title

๐Ÿ› Bug Report

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.

๐Ÿค” Expected Behavior

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.

๐Ÿ˜ฏ Current Behavior

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.

"TypeError: t.instruction.replace is not a function" when navigating with the browser's history buttons

๐Ÿ› Bug Report

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.

๐Ÿค” Expected Behavior

The router should correctly navigate back or forward to the given URL.

๐Ÿ˜ฏ Current Behavior

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:

navigation.path = (navigation.instruction as string).replace(/^\//, '');

๐Ÿ’ Possible Solution

I don't think the code really needs to set the navigation.path, seems to work without it.

๐Ÿ”ฆ Context

I am trying to create a single page admin interface and navigate between pages.

๐Ÿ’ป Code Sample

https://github.com/zenorbi/aurelia-direct-router-history-bug

๐ŸŒ Your Environment

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

Lifecycle hooks don't have access to the instance

๐Ÿ› Bug Report

When creating a lifecycle hook using the lifecycleHooks decorator, you cannot access this inside any of the methods such as canLoad.

๐Ÿค” Expected Behavior

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

๐Ÿ˜ฏ Current Behavior

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 `router.load` ends up not loading the route

๐Ÿ› Bug Report

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;
         }
}

๐Ÿค” Expected Behavior

I would expect you to be able to have return on the same line.

๐Ÿ˜ฏ Current Behavior

return this.router.load('someRoute'); //Does not load anything

this.router.load('someRoute'); //Loads the route
return;

๐Ÿ’ Possible Solution

return this.router.load('someRoute'); //Should Work
return await this.router.load('someRoute'); //Should Work

๐ŸŒ Your Environment

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

๐Ÿ› 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

"No definition found for type HTMLElement" error

๐Ÿ› Bug Report

When aurelia-direct-router": "^2.0.0-alpha.8.0 is used with [email protected] the app crashes

๐Ÿค” Expected Behavior

The app should load the configured route

๐Ÿ˜ฏ Current Behavior

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)

๐Ÿ’ป Code Sample

Install and use aurelia-direct-router in the default npx makes aurelia project with routing

๐ŸŒ Your Environment

Software Version(s)
Aurelia 2.0.0-alpha.9
Language Typescript

Error when installing package in freshly created project, when npx makes installs dependencies

๐Ÿ› Bug Report

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.

๐Ÿ’ป Code Sample

Sample steps

  • npx makes aurelia
  • name: test-router-1
  • Default TypeScript Aurelai 2 App

image

Error after npm start
image

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

๐ŸŒ Your Environment

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

Fix:

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.

Prevention in `canUnload` sometimes break navigation

๐Ÿ› Bug Report

In some cases, not allowing navigation in canUnload causes navigation to break.

๐Ÿค” Expected Behavior

All navigations involving canUnload should work.

๐Ÿ˜ฏ Current Behavior

Navigation stops working.

๐Ÿ’ Possible Solution

Investigate and fix.

You should be able to return a component from inside canLoad

๐Ÿ™‹ Feature Request

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.

๐Ÿค” Expected Behavior

You should be able to return a component from inside of canLoad like you can in the core router.

๐Ÿ˜ฏ Current Behavior

The component name as a string needs to be returned, which I believe is more difficult to test and flaky.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.