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

Grid not rerendering when isDraggable or isResizable changes #1151

Closed
darekkay opened this issue Feb 25, 2020 · 5 comments
Closed

Grid not rerendering when isDraggable or isResizable changes #1151

darekkay opened this issue Feb 25, 2020 · 5 comments
Assignees

Comments

@darekkay
Copy link
Contributor

darekkay commented Feb 25, 2020

Thanks a lot for the update!

However, I am facing issues after upgrading. I have an "Edit" button which toggles between "view mode" and "edit mode". I achieve it in the following way (see code):

      <ReactGridLayout
        isDraggable={isLayoutEditable}
        isResizable={isLayoutEditable}
        ...
      >

After the update, the Grid component does not rerender anymore, making it impossible to enter the "Edit mode". Here you can see the edit mode in action (before updating).

I think it is connected to #1123 and might be the same core issue as for #1150. It could also be connected to #892.

I can create a branch in my repository with the updated version of RGL if it helps you reproducing the issue.

@renomateo
Copy link

I'm having issues with onDrop and the placeholder not rendering. I can get the element to render in the DOM if I modify shouldComponentUpdate in https://github.com/STRML/react-grid-layout/blob/master/lib/ReactGridLayout.jsx#L201 by adding

||  !isEqual(this.state.droppingPosition, nextState.droppingPosition);

But it's still invisible. I think it's related to this issue, but I can file a separate issue if necessary.

@n1ghtmare
Copy link
Collaborator

Hey @darekkay, thanks for reporting this, indeed it seems to perform weird with the new faster comparison.

@STRML Somehow we missed this, sorry about that. I've run most examples and my own project and didn't notice the issues.

Anyway, I can now reproduce the problems on example-6, adding new items doesn't work unless we compare the children (which I see that you explicitly remove from the comparison for perf reasons).

Also, adding a switch to toggle isResizable and/or isDraggable on the grid doesn't really work properly (this one I'm not sure why since the props are both in the fastRGLPropsEqual comparison, I'm trying to debug it, will shout out if I find anything).

@STRML
Copy link
Collaborator

STRML commented Feb 26, 2020

Taking a look now.

@STRML
Copy link
Collaborator

STRML commented Feb 26, 2020

Thanks, fixed in 0.18.2, see https://github.com/STRML/react-grid-layout/blob/master/CHANGELOG.md#0182-feb-26-2020 for more detail.

@STRML STRML closed this as completed Feb 26, 2020
@darekkay
Copy link
Contributor Author

Thanks for fixing this so fast, now everything works just fine 👍

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

4 participants