maxholman / hyperapp-ssr-jsdom-example

An example of Hyperapp SSR with jsdom
2 stars 0 forks source link

global.document? #1

Open zaceno opened 6 years ago

zaceno commented 6 years ago

Hi Max! Thanks for sharing this experiment! Just a question: is there a reason you use the patched version of hyperapp, rather than simply setting global.document = fakeDocument ?

maxholman commented 6 years ago

Hi @zaceno!

A global document would certainly work if you are serving up the same content for every request, however, in the case where your state might be unique for each connection, you need a separate DOM for each request to avoid the risk of sending the wrong content to the wrong person during concurrent requests.

zaceno commented 6 years ago

Ah, that makes sense! (I knew there had to be a reason ;) )