ux icon indicating copy to clipboard operation
ux copied to clipboard

[LiveComponent] Update in for loop does not update child elements

Open sandoche opened this issue 3 years ago • 5 comments

Hi,

I am working on a demo todo app using LiveComponent. The project is here: https://github.com/sandoche/Symfony-ux-live-component-todo-list/

It looks like this: image

I created some filters using this parameter

  #[LiveProp(writable: true)]
  public $filter;

and using this method

  private function loadTasks()
  {
    if ($this->filter == 'all') {
      $this->tasks = $this->taskRepository->findAll();
    } else {
      $this->tasks = $this->taskRepository->findBy(
        ['isDone' => $this->filter == 'done' ? true : false]
      );
    }
  }

When I click on one of filter it does show the right number of items. But not the right ones.

This is what I see when I click to do image

I should instead see "Ranger voiture" and "Ranger vêtements" that are unchecked.

You can see the code here: https://github.com/sandoche/Symfony-ux-live-component-todo-list/blob/main/src/Components/TodoList.php

sandoche avatar Sep 29 '21 13:09 sandoche

I have a similar issue. I have a basket component with OrderLines. Each OrderLine has a child component RemoveEntry, which shows a form with a single submit button.

If I do anything to cause the parent basket component to reload, some of the child components do not show.

Weirdly, the child components that do not show the button, the <form> element does render, but not the button inside the form - all I see is

<form blah blah>
    <div class="form-group"></div>
</form>

The button is defined in the form type class using SubmitType::class rather than being hard-coded into the Twig template.

benr77 avatar Nov 25 '21 07:11 benr77

Thank you for this issue. There has not been a lot of activity here for a while. Has this been resolved?

carsonbot avatar Apr 26 '24 12:04 carsonbot

Could I get a reply or should I close this?

carsonbot avatar May 11 '24 08:05 carsonbot

Hey,

I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen!

carsonbot avatar May 25 '24 14:05 carsonbot