Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rendering the same content on both server and client causes a loss of events #750

Closed
krainboltgreene opened this issue Nov 27, 2017 · 13 comments

Comments

@krainboltgreene
Copy link

Code to reproduce the issue:

https://github.com/krainboltgreene/deushack

Expected behavior:

If I click on an element I should receive a click event.

Actual behavior:

Nothing happens

Versions of packages used:

Latest

@krainboltgreene
Copy link
Author

I'm able to hack around this by either rendering something different after client side has booted. For example, if I add a data-created-at=new Date() to a dom tree element I suddenly get my events.

I'm guessing this is as much snabbdom as cycle/dom?

@staltz
Copy link
Member

staltz commented Nov 27, 2017

Hi @krainboltgreene
Thanks for letting us know about this.
I think I can reproduce this by updating libraries in examples/advanced/isomorphic and not having click events preventDefault'd on client side.

@staltz staltz added this to In progress in staltz's pipeline Nov 27, 2017
@krainboltgreene
Copy link
Author

Let me know if I can help with this at all.

@staltz
Copy link
Member

staltz commented Nov 27, 2017

Thanks @krainboltgreene. I think it would help to discover what was the lowest versions of cycle/dom, cycle/run, and cycle/html where the bug happens, and the highest versions of cycle/dom|run|html where the bug does not happen.

@krainboltgreene
Copy link
Author

Will do when I get home.

@staltz
Copy link
Member

staltz commented Feb 22, 2018

Any updates on this issue? I would like to solve it (and have some time for solving it) but I need to know first if it's a real issue in the framework.

@Tzelon
Copy link

Tzelon commented Aug 31, 2018

The issue is still relevant I create a repo to reproduce the problem
https://github.com/Tzelon/cycle.js-ssr-bug

@jvanbruegge
Copy link
Member

@Tzelon You have to remove the sinks.DOM = sinks.DOM.drop(1). It wont do anything to the DOM, but it will initialize the isolation scopes within cycle
Just commenting out this line and your repo works

@Tzelon
Copy link

Tzelon commented Sep 2, 2018

Thanks.
I thought the drop part should be there so we don't re-render the DOM.

@jvanbruegge
Copy link
Member

Snabbdom figures out that the dom did not change and does not rerender

@jvanbruegge
Copy link
Member

As I had no issues getting the excellent example of @Tzelon to work and the original repro segfaults, I will close this issue.
As far as I can tell is the original issue fixed with @cycle/dom v21

@Tzelon
Copy link

Tzelon commented Sep 3, 2018

Thanks, @jvanbruegge this solved my issue.
Can we update the isomorphic example?
The client.js code from my repo copied from there https://github.com/cyclejs/cyclejs/blob/master/examples/advanced/isomorphic/client.js

@jvanbruegge
Copy link
Member

Yeah, I will update all examples in the next weeks (#802)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

4 participants