preactjs / preactjs/preact-render-to-string
`options._diff` not called for implicit Fragments
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 726
- Forks
- 101
- Avg merge
- 3d 6h
- Merged PRs (30d)
- 6
Description
import { render, h,options, Fragment} from "preact"
import renderToString from "preact-render-to-string"
const oldDiff = options.__b;
options.__b = (vnode) => {
if (vnode.type === Fragment) {
console.log(vnode.type === Fragment ? vnode.props:null)
}
if (oldDiff) oldDiff(vnode)
}
function App() {
return <div>
<h1>test</h1>
{[
<p key="1">1</p>,
<p key="2">2</p>,
<p key="3">3</p>,
]}
</div>
}
const app = document.getElementById("app");
render(<App />, app)
console.log("=====")
// Fragments not visible in options._diff with RTS
renderToString(<App />);
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the JSX reproduction comparing client render with renderToString and observe whether options.__b receives implicit Fragment vnodes. Trace the renderToString path and its Fragment handling; done when implicit Fragments trigger the expected hook consistently with client rendering.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 43/100