chore(layer): demo issue with context from different modules#16
chore(layer): demo issue with context from different modules#16HendrikThePendric wants to merge 2 commits intoalphafrom
Conversation
| zIndex: propTypes.number, | ||
| } | ||
|
|
||
| export { LayerTwo, useLayer } |
There was a problem hiding this comment.
This is just a duplicate of the Layer from LayerContext.js but with a different name.
| export const ItFallsApart = () => ( | ||
| <Layer zIndex={FIXED_INDEX}> | ||
| {zIndexComputed => ( | ||
| <> | ||
| <h1>{zIndexComputed}</h1> | ||
| <LayerTwo zIndex={FIXED_INDEX}> | ||
| {anotherZIndexComputed => <h1>{anotherZIndexComputed}</h1>} | ||
| </LayerTwo> | ||
| </> | ||
| )} | ||
| </Layer> | ||
| ) |
There was a problem hiding this comment.
It goes wrong here, because each layer is referring to a different base context.
|
In 1e5c903 I've found a "fix" for this problem. The only way I could think of was to attach the context to the window to avoid duplicates from being created. It's definitely not the most elegant solution available, but I couldn't think of another way to solve it. Any other suggestions would be most appreciated.... Personally I can't think of any other way to solve this, apart from not allowing several instances of ui-core from being used in one app.... Which, to be fair, probably is something worth discussing further anyway.... |
|
Are we looking for an intermediate solution here, while we figure out a long term solution to the whole zindex issue? Just for some context on the solution we're looking for, because as an intermediary solution something dirty seems less problematic. |
This is not a real PR, it's just a minimalistic demo of the issue @martinkrulltott found....
We should look into a way of creating the context differently....