DAB0mB/Appfairy

React-router warnings

Geofflew opened this issue · 7 comments

First off, love this app! Rely on it a lot.

I noticed that when I was using react-router to navigate (Link and history.push) it was throwing me an error of

TypeError: e is not a function
r.define
src/views/DiscoverView.js:38
35 | componentDidMount() {
36 | scripts.concat(Promise.resolve()).reduce((loaded, loading) => {
37 | return loaded.then(script => {
**> 38 | new Function(with (this) {eval(arguments[0])}** | ^ 39 | ).call(window, script);
40 |
41 | return loading;

I managed to fix it by manually going into the appfairy generated view page and adding a "$" in front of it, changing it to "$ {eval(arguments[0])}", and now it works fine with react-router

Not sure whether its just the way I am using appfairy, or generating the pages, but posting this here just in case other people have the same issue

tnici commented

Same thing for me. Thanks for posting your workaround.

Thanks a lot. It is working for me.

Thanks, this worked for me too.

Your solution might have potential side effects because you run evaluation on the same scope, I would need more info inorder to tackle that, have an example repo or something

First, great solution! thanks
I had the same issue when using the router and used the $ workaround to solve it but appreciate a more sustainable solution

I have the same issue. In my case is not a warning, but an error and the solution provided here did not work although it's not really a proper solution anyway since it will require that manual change every time the views are updated. Any news on this?

to be fair, the solution provided here seems unreadable. He says and adding a " {eval(arguments[0])}", and now it works fine with react-router
I don't know if since the day he posted git might be parsing some character he wrote there, but I don't quite understand what Im supposed to do. Can anyone help?