-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AXAContainer + react-router + children problem #859
Comments
Hi makre, thank you for submitting this. I belive this is the issue with the Children of Children dynmaic rendering. We can only fix this in v2 unfortunatly. |
Hi @LucaMele ! Just wonder whether this kind of error is solvable at all with the current status of React and Web Components. What do you think? |
We are not the first one doing this. Frameworks like Ionic also solved it so im pretty sure is solvable. So far in our tests it did work with the library skatejs/val. Its a library that syncs vdom and dom. For controled input instead, we do the same as react does, setting and resetting after. All tests we did are very promising so far. U can checkout develop-v2 branch. But if its not solvable, we will write 2 components: 1 in react and 1 as custom element. Therefore for you, when u import the component, it will definitely work. |
@MarekLacoAXA I will be the one to do an experiment to show this works in v2. Could you help me understand your use case by attaching a minimal React code snippet that shows the problem (in v1, of course)? |
@LucaMele
This PR contains the reproduction test scenario: |
Hi @markus-walther ! I was unable to reproduce this issue without using react-router. Therefore I think, this issue is related to react-router and the Here is my minimalistic error example. It generates two timestamps. Navigating to page "foo" and "bar" should refresh both timestamps. But the timestamp enclosed in AXACol doesn't change. import { AXACol } from '@axa-ch/patterns-library/lib/js/react-exports';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { withRouter } from 'react-router';
import { BrowserRouter } from 'react-router-dom';
const CurrentTime = () => (
<strong>
{new Date().toLocaleString()}
</strong>
);
class Content extends React.Component {
public render() {
return (
<>
<div onClick={() => this.props.history.push('/foo')}>foo</div>
<div onClick={() => this.props.history.push('/bar')}>bar</div>
{this.props.children}
</>
);
}
}
const ContentWithRouter = withRouter(Content);
export class App extends React.Component {
public render() {
return (
<BrowserRouter>
<ContentWithRouter>
<AXACol>
<CurrentTime/>
</AXACol>
<CurrentTime/>
</ContentWithRouter>
</BrowserRouter>
);
}
}
ReactDOM.render(
<App/>,
document.getElementById('root'),
); |
Thanks @MarekLacoAXA ! As discussed privately, the belief is that "[...]any component using the |
@MarekLacoAXA Tests:
Todo:
Publicly available at: Please share your thoughts. From my point of view, this is good enough, only the Personally I'm still keen to find out why React's event system can't handle these custom element nodes 😕 |
Sorry, my Example from March 14 was too complicated. Problem:
|
@MarkLacoAXA |
@MarekLacoAXA, @markus-walther is working on it and we have our own test environment. Please contact directly hin |
@MarekLacoAXA PS: all of you can edit and extend these tests, feel free to do so PPS: I just added the plib V1 components out of curiosity, and they are broken even with skate/val 😞 |
@MarekLacoAXA If all of you agree I close this ticket? |
Problems using AXAContainer / AXARow / AXACol experienced:
AXAContainer
Rerender, children passed to
<AXAContainer>
change, but the output keeps being the same.axa-container
Rerender, children passed to
<axa-container>
change, react crashes:The text was updated successfully, but these errors were encountered: