wesleytodd / nighthawk

A wrapper around Express' router for the browser
ISC License
55 stars 7 forks source link

Issue with react 16 #13

Closed mohitmayank closed 6 years ago

mohitmayank commented 6 years ago

I am unable to pin point exact issue. but when a anchor containing target="_blank" is rendered with react, intercept-link-clicks works as expected and Router.onClick isnt called. But link still doesn't work.

If a link contains an external url (window.location.host different) intercept-link-clicks doesn't work and Router.onClick is called and link doesn't work even with reloadOnUnhandled.

I am using react 16.

wesleytodd commented 6 years ago

Hey @mohitmayank! I have used target="_blank" links with React and Nighthawk in the past and they worked as expected. So I am not sure whats up.

Could you maybe you could post some code? A reduced test case would be best. Without that I am unsure how I can help.

mohitmayank commented 6 years ago

I know its out of the blue. I am trying to debug this. I am pretty sure its related to Synthetic events somehow. I tired converting your example with react16. and it works fine for target="_blank". Just my main setup doesn't work. i am using mobx. and debugger is a nightmare with that.

So far my findings, issue is only in chrome. firefox works fine. All the normal links works fine. as soon as target="_blank" is added links doesnt work.

wesleytodd commented 6 years ago

I have not used mobx, so unfortunately I cannot say anything about it. Good luck! But unless you can post some code I really cannot help debug this more deeply.

mohitmayank commented 6 years ago

It was a something very stupid. i had content security policy without allow-popups for sandbox. All the external links were not working and somehow this warning was not getting displayed because of react.

Wasted a whole day on this. complete disaster.

Anyways. thanks for your help. its a great module. I have used it to write a isomorphic router for my app.

Closing this issue.

wesleytodd commented 6 years ago

Glad you figured it out and sorry it was such a pain. Glad you found this useful, and let me know if you have any other issues!