liveview-native / liveview-native/liveview-client-swiftui

[Bug]: Views in List view in Tab view not updating correctly

Open
#1,441 8 comments 0 reactions 1 assignee View on GitHub

@carson-katri is already working on this.

Since Sep 11, 2024.

bug v0.3
Dominant language
Swift
Stars
440
Forks
45
PR merge metrics
No merged PRs in 30d

Description

What happened?

I noticed that if an event updates the order of items in a list and at the same time updates a property of a list item in a tab view, after navigating from another tab, then the list no longer behaves as expected after the first update.

Without reordering (working):

https://github.com/user-attachments/assets/a8662731-7a09-4f33-8fce-b170505434c6

With reordering (not working) after navigating from another tab:

https://github.com/user-attachments/assets/5f048a15-ed56-4b08-b483-225605b3a735

Note that the circular indicator does not change even as the list order changes.

Relevant code:

<TabView selection={@selection} phx-change={@on_change}>
  <VStack tag="..." style="tabItem(:item)">
    <Label template="item" systemImage="...">
      ...
    </Label>
    <List style="listStyle(.plain)">
      <Section>
        <Text template="header">
          Meat counter
        </Text>
        <HStack id={"item_" <> item.id} :for={item <- @items}>
          <Image
            systemName={if item.in_cart, do: "largecircle.fill.circle", else: "circle"}
            style="imageScale(.large); foregroundColor(.accentColor);"
            phx-click="toggle_completed"
            phx-value-id={item.id}
          />
          <Text>
            <%= item.title %>
          </Text>
          <LabeledContent>
            <%= item.detail %>
          </LabeledContent>
        </HStack>
      </Section>
    </List>
  </VStack>
</TabView>
Library Version

0.3.0

Xcode Version

15.4 (15F31d)

Swift Version

No response

On which device or simulator are you running into the problem?

iPhone

Target Device Operating System Version

17.2

Relevant log output

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.