tfrydrychewicz / aurelia-flux

Flux dispatcher plugin for Aurelia
MIT License
74 stars 17 forks source link

Error with latest Aurelia #18

Open LivesleyWA opened 8 years ago

LivesleyWA commented 8 years ago

I have other errors so the latest Aurelia release may have issues but, when I add the plugin declaration I get the following. This was working yesterday so it's something to do with Aurelia changes.

Error: Pipeline steps can only be added to the root router at RouterConfiguration.exportToRouter (http://localhost:50082/jspm_packages/github/aurelia/router@0.12.0/aurelia-router.js:475:17) at Router.configure (http://localhost:50082/jspm_packages/github/aurelia/router@0.12.0/aurelia-router.js:1195:26) at Function.AddFluxPipelineStep (http://localhost:50082/jspm_packages/github/tfrydrychewicz/aurelia-flux@0.1.7/router.js:19:14) at r.configure (http://localhost:50082/jspm_packages/github/tfrydrychewicz/aurelia-flux@0.1.7/index.js:14:31) at http://localhost:50082/jspm_packages/github/aurelia/framework@0.17.0/aurelia-framework.js:34:34 at run (http://localhost:50082/jspm_packages/npm/core-js@0.9.18/modules/es6.promise.js:91:43) at http://localhost:50082/jspm_packages/npm/core-js@0.9.18/modules/es6.promise.js:105:11 at module.exports (http://localhost:50082/jspm_packages/npm/core-js@0.9.18/modules/$.invoke.js:6:25) at queue.(anonymous function) (http://localhost:50082/jspm_packages/npm/core-js@0.9.18/modules/$.task.js:40:9) at Number.run (http://localhost:50082/jspm_packages/npm/core-js@0.9.18/modules/$.task.js:27:7) at listner (http://localhost:50082/jspm_packages/npm/core-js@0.9.18/modules/$.task.js:31:9)

tfrydrychewicz commented 8 years ago

That's been already solved. Unfortunately there is a bigger issue with new DI container. Aurelia Team will add a hook for aurelia-flux. When I have that, I'll publish new version. That should be somewhere this week.

charlespockert commented 8 years ago

@LivesleyWA @tfrydrychewicz there's a configure callback on the router that you want to use instead which ensures that you don't run into issues with making the router already configured when the host app tries to configure it:

router.ensureConfigured().then(() => {
      let configuration = new RouterConfiguration();
      configuration.addPipelineStep("modelbind", FluxLifeCycleStep);
      router.configure(configuration);
});

A hook on the container would be good - I made a fork to try and tackle it but it means intercepting in a couple of places and gets a little tricky (though it seems possible). Container hook would solve those problems :) look forward to getting an update

tfrydrychewicz commented 8 years ago

The problem with Error: Pipeline steps can only be added to the root router was caused by the DI not resolving Router with root router.

import {Router} from 'aurelia-router';
let router = aurelia.container.get(Router);

It used to do that, but it doesn't do that anymore. I thought that resolving AppRouter instead of Router should help here.

LivesleyWA commented 8 years ago

Thanks for the above tip. It would appear that major changes have been made to routers/pipeline and, as a result, an application which was working for me on Saturday night is now broken. I have a number of issues registered, of which this is one - although I am pretty sure that they are all related to the issue identified by @tfrydrychewicz. I am waiting for stability before continuing because hitting my head against a wall has limited charms. I hope the issues are resolved this week because, if not, my choice of Aurelia over Angular will be questioned which would be a pity.

LivesleyWA commented 8 years ago

Tomasz, Is there any update from the Aurelia team on the adjustments and likely delivery date?

niieani commented 8 years ago

+1 on this. Many thanks for the great work so far!

yieme commented 8 years ago

+1

iovergard commented 8 years ago

Any news on this?

EisenbergEffect commented 8 years ago

@tfrydrychewicz We had the Beta release today. A lot of people would like to use the plugin, but it needs to be updated.

cdennig commented 8 years ago

+1

victor-foster commented 8 years ago

Any update on the status of updating this plugin to work with Aurelia Beta?

AdamWillden commented 8 years ago

if this is still an issue then +1 here too, I'm looking at using Aurelia and really wanted to use this plugin. @tfrydrychewicz are you looking to fix this?

tkhyn commented 8 years ago

@AdamWillden you may want to try and use this fork: tkhyn/aurelia-flux

AdamWillden commented 8 years ago

@tkhyn after I posted I saw PR #22 which is essentially your fork - thanks for doing it!

I noticed that the PR says CI is failing. Is that anything to be concerned about or is it an issue with the CI itself do you know?

Thanks again.

tkhyn commented 8 years ago

@AdamWillden it looks like it's an issue with the CI itself, that uses a version of Firefox (31) that does not seem to support some SystemJS polyfills (https://travis-ci.org/tfrydrychewicz/aurelia-flux/builds/95719298). I did not care to investigate further as all tests pass with Chrome and Firefox 42+.

AdamWillden commented 8 years ago

@tkhyn thanks. Just wanted that bit of confidence :+1:

tomasbonco commented 8 years ago

Hello @tkhyn! I need to use Flux with Beta 1 and because this repo seems not to be actual, I tried to use your PR. I forked it, and made a release, but I'm still getting error: Error: Pipeline steps can only be added to the root router Is there any chance to get it working?

AdamWillden commented 8 years ago

@tomasbonco I think I did the same as you've done. jspm works with releases so you need to specify @master to get the master branch as follows:

  {
      ...
      "aurelia-flux": "github:tkhyn/aurelia-flux@master",
  }
AdamWillden commented 8 years ago

oh sorry I just read you made a release on your own fork. I don't know then... same error though

tkhyn commented 8 years ago

@tomasbonco I have no problem when I use github:tomasbonco/aurelia-flux@1.7 instead of github:tkhyn/aurelia-flux@master in the jspm/dependencies section of package.json and run jspm install. Just tested it on my fork of the sample aurelia-flux-todo app.