Appfairy icon indicating copy to clipboard operation
Appfairy copied to clipboard

React-router warnings

Open Geofflew opened this issue 5 years ago • 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

Geofflew avatar Apr 18 '19 15:04 Geofflew

Same thing for me. Thanks for posting your workaround.

tnici avatar Jul 02 '19 07:07 tnici

Thanks a lot. It is working for me.

constantinX avatar Jan 28 '20 13:01 constantinX

Thanks, this worked for me too.

JeffreyYu2018 avatar Feb 24 '20 21:02 JeffreyYu2018

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

DAB0mB avatar Nov 22 '20 04:11 DAB0mB

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

hosseinSey avatar Apr 14 '21 22:04 hosseinSey

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?

Instrumedley avatar May 29 '22 19:05 Instrumedley

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?

Instrumedley avatar May 30 '22 13:05 Instrumedley