Remove `parent` as 1st mandatory argument for patch
See original GitHub issueHaving parent
as first argument works very well when the all app is designed and wrote with picodom but not that much when used in a mixed libs app. (yes it happens in real world)
You cannot then just render / create a component to get its main node and then append it manually to a parent node of your choice at the time you choose.
To get around this you have to create a fake parent with document.createElement
but that add a useless layer.
I’m also not a big fan of that kind of dependency injection and lake of separation which introduce a dependence between the child and its parent, I do prefer the other way, parent knowing its children, but I think this is just a matter of taste.
Issue Analytics
- State:
- Created 6 years ago
- Comments:43 (31 by maintainers)
Top Results From Across the Web
python - Getting TypeError: __init__() missing 1 required ...
Getting TypeError: __init__() missing 1 required positional argument: 'on_delete' when trying to add parent table after child table with entries.
Read more >Gerrit Code Review - Review Labels
If an approval on an outdated patch set is removed or updated to a value that is not ... The first parent of...
Read more >Cascade Delete - EF Core | Microsoft Learn
Configuring cascading behaviors triggered when an entity is deleted or severed from its principal/parent.
Read more >unittest.mock — mock object library — Python 3.11.1 ...
mock provides a core Mock class removing the need to create a host of stubs throughout your test suite. After performing an action,...
Read more >git-format-patch Documentation - Git
The "patch", which is the "diff -p --stat" output (see git-diff[1]) between the ... The optional <style> argument can be either shallow or...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ve abandoned my original plans since proposing #91, but I’ve stayed subscribed to this thread because I find it interesting, lol.
On that note, my goal there was twofold:
As you can see in here,
patch
accepts two VDOM nodes, and uses internal_ref
props that associate mounted nodes to their DOM node counterparts to find parent, children, and nextSibling references.JorgeBucaran expressed some concern with mutating the node structure with private fields. I don’t share that concern, but I am probably inexperienced in this area so I defer.
The same pattern could definitely be achieved using @mindplay-dk’s proposal of an internal map. I had considered this when I was poking around #91, but was concerned about reliably creating unique indices to associate VDOM nodes to DOM nodes in the map, as well as the additional lookup and memory allocation. Attaching it to the VDOM node via
_ref
seemed like a more stable and compact solution.At any rate, my 2¢ is that there should be a separate
mount
function that initializes a VDOM tree. Then there should be apatch
function solely for patching said VDOM tree.It’s been fun to see this discussion unfold 😃
I’ve said that before, but my personal goal is to have something that is simple and useful - I’m only counting bytes to get an idea of whether it’s still small, the impact of making a change, and so on. 1K or 2K is besides the point for me 😃