Skip to content
This repository has been archived by the owner on Nov 29, 2017. It is now read-only.

Changing data on card #11

Open
gummie4444 opened this issue May 24, 2017 · 1 comment
Open

Changing data on card #11

gummie4444 opened this issue May 24, 2017 · 1 comment

Comments

@gummie4444
Copy link

If you would write a new reducer that would change the card

EXAMPLE:

    case CHANGE_CARD: {
      const newLists = [...state.lists];
      // First card in first row
      newLists[0].cards[0].title = "test";

      return state.withMutations((ctx) => {
        ctx.set('lists', newLists);
      });

This results in

  • The state updates
  • Board re-render with new props
  • CardsContainer re-render with new props
  • Cards re-render with new props

But here is the error, when debugging the code in the Render function in Cards, the CardList array is updated and if you look at the CardList data the props have the new title as "test" BUT DraggableCard does NOT re-render.

But as soon as you move the card by dragging, then the re-render of DraggableCard works and the correct title "test" is rendered.

image

@gummie4444
Copy link
Author

gummie4444 commented May 24, 2017

If you change the ID everything work's as normal because the ID is a key for the Card component.

A workaround could be to have a "updated" time stamp on each item and use that time stamp + the id as the key to force the re-render on update but that is hacky

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

No branches or pull requests

1 participant