Skip to content
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

render() not triggered when component is connected with preact-redux #320

Open
untitledlt opened this issue Jun 5, 2019 · 2 comments
Open

Comments

@untitledlt
Copy link

untitledlt commented Jun 5, 2019

I tried a minimal install with latest preact-cli.
Right after component is connected with preact-redux, navigating to route with query params stops triggering rerender.

F.e. navigating to /profile or / works fine but that's not the case with /profile/john.
It works if i refresh page or after something (redux?) triggers props change.
handleRoute function attached to <Router/> works fine.

With older versions (not sure preact or preact-router) everything works fine.

import { h, Component } from 'preact';
import { Link } from 'preact-router/match';
import { connect } from 'preact-redux';

@connect(state => state, { })
export default class Profile extends Component {
    render({ user }) {
        return (
            <div>
                <h1>Profile: {user}</h1>

                <Link href="/">Home</Link>  {/* this works fine */}
                <Link href="/profile">Me</Link>
                <Link href="/profile/john">John</Link>
                <Link href="/profile/foo">foo</Link>
                <Link href="/profile/bar">bar</Link>
            </div>
        );
    }
}
@developit
Copy link
Member

I looked into this and added a reproduction to the preact-redux issue. It's not likely to be related to preact-router, but rather that rendering a connected component with new props does not reevaluate its redux bindings.

@untitledlt
Copy link
Author

I have migrated to preactx and react-redux. The issue is gone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants