choojs / choojs/nanocomponent

leaky proxy nodes when morphing

Open
#65 13 comments 3 reactions 0 assignees View on GitHub
help wanted
Dominant language
JavaScript
Stars
364
Forks
29
PR merge metrics
No merged PRs in 30d

Description

Not sure if we want this issue here or in [nanomorph](https://github.com/choojs/nanomorph), but looks like proxy nodes are leaked when a component is morphed to a new location in the dom. For example, if these two views are morphed, a proxy node will be rendered rather than the component:

```js
function viewA (state, emit) {
return html`

beep
boop


${component.render()}


`
}

function viewB (state, emit) {
return html`

beep
boop
${component.render()}

`
}
```

You can see this behavior here:

- Demo: https://choo-leaky-proxy.glitch.me
- Code: https://glitch.com/edit/#!/choo-leaky-proxy?path=index.js:1:0

Also interesting to note if the component's update function returns `true`, the component will leak the proxy node on first morph, while subsequent morphs will correctly return the component.

Contributor guide

No contributing guide indexed for this repository

Research direction

Run the linked demo and inspect the Glitch index.js reproduction, comparing the viewA and viewB morphs. Trace the component.render() and update-function behavior through the nanomorph path; done means the component remains rendered at its new location without a leaked proxy node, including on the first morph when update returns true.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.