Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

Getting Error: not implemented #6

Closed
mhaagens opened this issue Feb 3, 2017 · 5 comments
Closed

Getting Error: not implemented #6

mhaagens opened this issue Feb 3, 2017 · 5 comments
Labels

Comments

@mhaagens
Copy link

mhaagens commented Feb 3, 2017

Great library! I'm trying to use this with Express, but can't seem to get it to work.
I'm getting this error;

Error: not implemented
    at Readable._read (_stream_readable.js:470:22)
    at Readable.read (_stream_readable.js:348:10)
    at resume_ (_stream_readable.js:737:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

This is my render function;

const renderApp = (req, res) => {
    const context = {};

    const application = renderToStream(
        <StaticRouter location={req.url} context={context}>
            <App />
        </StaticRouter>
    );

    const html = streamTemplate`<!doctype html><html>
      <head>
        <title>Test</title>
      </head>
      <body>
        <div id="root">${application}</div>
        ${process.env.NODE_ENV === 'production' ? '<script type="text/javascript" src="/assets/vendor.js"></script>' : ''}
        <script src="/assets/app.js"></script>
      </body>
    </html>`

    if (context.url) {
        res.writeHead(302, { Location: context.url });
        res.end();
    } else {
        toNodeStream(html).pipe(res)
    }

};

Any idea as to what's going wrong here?

@divmain
Copy link
Contributor

divmain commented Feb 3, 2017

You're the first person to pull this down and give it a try! Let me get back to you tomorrow morning, it has been a couple of late nights to put my thoughts into code.

@mhaagens
Copy link
Author

mhaagens commented Feb 3, 2017

I'm really excited for this library, great work!
I'm using renderToString from rapscallion now and it shaved off roughly ~200ms from my server render, so I'm very excited about getting the streaming working. Whenever you have time to take a look at it that would be awesome :)

@mhaagens
Copy link
Author

mhaagens commented Feb 3, 2017

I'll just post this here as well, when used with React Router renderToString returns;

TypeError: Cannot read property 'createHref' of undefined

in case you're using this with React Router as well and know what's causing this?

@divmain divmain added the bug label Feb 3, 2017
@divmain divmain closed this as completed in 609e3ef Feb 3, 2017
@divmain
Copy link
Contributor

divmain commented Feb 3, 2017

@mhaagens, the stream issue should be fixed and release in 1.0.2. Could you open an issue regarding React Router, possibly with a minimal reproduction? I haven't done too much testing yet, so real-world examples will be hugely useful to me.

Bed now though, for realz this time.

@mhaagens
Copy link
Author

mhaagens commented Feb 3, 2017

Thanks for the super fast fix! I'll open an issue regarding React Router.
And yeah, get some sleep 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants