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

RowEnhancer Dynamic Content Causing Re-render #853

Open
Natas0007 opened this issue Jun 3, 2019 · 1 comment
Open

RowEnhancer Dynamic Content Causing Re-render #853

Natas0007 opened this issue Jun 3, 2019 · 1 comment

Comments

@Natas0007
Copy link

Natas0007 commented Jun 3, 2019

Griddle version

1.13.1

Expected Behavior

No full re-render on row click.

Actual Behavior

Griddle seems to fully re-render when adding/removing state-based content with RowEnhancer. I am using LocalPlugin.

Steps to reproduce

First off, Griddle rocks! Using the below RowEnhancer in the components prop works perfectly except that Griddle seems to re-render each time a row is selected, or "expanded". I suspect this because any sort is reset to default when a row is selected. Granted, the "hidden" row is expanded as expected based on state...but the sort is reset. I'm thinking maybe there is a more preferred way for me to be showing/hiding rows. I have a feeling tracking sortProperties in state might solve this problem, but if there is a preferred way for me to be hiding/showing this per-row content, that would be great! Thx!

RowEnhancer: compose(
                  EnhanceWithRowData,
                  OriginalComponent =>
                    props => (
                      <>
                        <OriginalComponent
                          {...props}
                          onClick={() => this.handleRowClick(props.rowData.userId)}
                        />
                        {this.state.selectedUserId === props.rowData.userId ?
                          <tr className="griddle-row">
                            <td className="griddle-cell" colSpan="7">
                              ...
                            </td>
                          </tr>
                          : null}
                      </>
                    )
                )
@Natas0007
Copy link
Author

I have this working by fulling removing the default sortProperties...but as mentioned, if there is a preferred method of what I'm doing, any assistance would be much appreciated. Thank you!

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

1 participant