sidorares / react-x11

React renderer with X11 as a target

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Investigate ways to perform top-down rendering instead of bottom-up

sidorares opened this issue · comments

AFAIK Currently react forces you to build components bottom-up. In DOM case, you create leaf node using document.createElement, then parent component creates itself and inserts existing child etc etc.

X11 api prefers building controls top-down: you do CreateWindow(root, mainWindowId), then CreateWindow(newWindowId, childControlWindowId) etc. With bottom-up order the only option is to create window as child of root window and then later do ReparentWindow call, but this has several disadvantages: more network requests, root window children are special and can be placed somewhere else by window manager etc etc. Most of the issues can have work around (don't map and set override-redirect flag until full render is finalised) but overall much more less straightforward compared to top -> down option

https://github.com/facebook/react/blob/b1b4a2fb252f26fe10d29ba60d85ff89a85ff3ec/src/renderers/shared/fiber/ReactFiberCompleteWork.js#L261-L272 suggests that this might be an option in future react versions but not possible currently?

          // TODO: Move createInstance to beginWork and keep it on a context
          // "stack" as the parent. Then append children as we go in beginWork
          // or completeWork depending on we want to add then top->down or
          // bottom->up. Top->down is faster in IE11.

looks like this is achieved by moving up from HostConfig to Reconciler level?