marko-js-archive / marko-widgets

[LEGACY] Module to support binding of behavior to rendered UI components rendered on the server or client
http://v3.markojs.com/docs/marko-widgets/
MIT License
142 stars 40 forks source link

<init-widgets immediate/> throws error "write after end" #135

Closed sampology closed 8 years ago

sampology commented 8 years ago

using

<init-widgets immediate/>

without

<async-fragments/>

throws an error when using koajs

Listening on port 3000
events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: write after end
    at ServerResponse.OutgoingMessage.write (_http_outgoing.js:422:15)
    at Object.BufferedWriter.flush (/home/www/markotest/node_modules/async-writer/lib/AsyncWriter.js:65:27)
    at Object.BufferedWriter.end (/home/www/markotest/node_modules/async-writer/lib/AsyncWriter.js:74:14)
    at AsyncWriter._finish (/home/www/markotest/node_modules/async-writer/lib/AsyncWriter.js:485:26)
    at AsyncWriter.handleEnd (/home/www/markotest/node_modules/async-writer/lib/AsyncWriter.js:478:22)
    at AsyncWriter.end (/home/www/markotest/node_modules/async-writer/lib/AsyncWriter.js:439:18)
    at /home/www/markotest/node_modules/marko-widgets/taglib/init-widgets-tag.js:49:18
    at next (/home/www/markotest/node_modules/async-writer/lib/AsyncWriter.js:380:17)
    at ServerResponse.<anonymous> (/home/www/markotest/node_modules/async-writer/lib/AsyncWriter.js:384:17)
    at ServerResponse.g (events.js:260:16)
patrick-steele-idem commented 8 years ago

Looks like we need update the docs for Koa need to be updated to use the Koa recommended way of supporting streaming:

this.body = template.stream(data);

That solved the problem.