question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove usage of `renderToHTML` from all examples

See original GitHub issue

The renderToHTML is a private API that seems to have accidentally leaked into our examples. We should remove the usage of this function from all examples that have it.

Specifically:

  • custom-server-hapi
  • ssr-caching
  • examples/with-flow/flow-typed/next.js.flow

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:14
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

27reactions
Charioteercommented, Aug 25, 2020

@Timer As already stated by @sagar-gavhane there should be an option to manually render a page to HTML. I’ve already commented on @madiknox’s commit that the changes are breaking e. g. the ssr-caching example. The removal of renderToHTML is a critical break and will also break many production apps (like ours) if it won’t be accessible at all anymore. I suggest to add an intended public low-level API (with documentation) for rendering manually. renderToHTML() should not call res.end() as well because it leads to a need of “crazy” workarounds like the following to actually cache HTML responses:

const _resEnd = res.end.bind(res)
    res.end = function (payload) {
    if (res.statusCode === 200) {
        ssrCache.set(key, payload)
    }
    return _resEnd(payload)
}
await app.renderToHTML(req, res, pagePath, queryParams)
8reactions
sagar-gavhanecommented, Jun 30, 2020

which alternative public method we’re going to use?

Read more comments on GitHub >

github_iconTop Results From Across the Web

php - RenderToHtml viewfile and return a string? - Stack Overflow
I made a small MVC Framework, but i need that my view Class can return the page as string but before that apply...
Read more >
ReactDOMServer – React
Render a React element to its initial HTML. React will return an HTML string. You can use this method to generate HTML on...
Read more >
Render HTML file in Node.js and Express.js framework
In this short tutorial, I am going to explain to you how to render HTML files in a custom NodeJS and ExpressJS Server....
Read more >
HTML Basics - Quarto
Use the number-depth option to specify the deepest level of heading to add numbers to (by default all headings are numbered). For example:...
Read more >
Introduction — Agile UI documentation - Read the Docs
the usage of { denotes a “tag” inside your HTML, which must be followed by ... Once template is initialized you can renderToHtml()...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found