Git Product home page Git Product logo

ForEach<_StoreCollection<String, State, Action>, ObjectIdentifier, SingleTaskView>: the ID ObjectIdentifier(0x0000600003fe8b40) occurs multiple times within the collection, this will give undefined results! about swift-composable-architecture HOT 2 CLOSED

zhangpeibj01 avatar zhangpeibj01 commented on June 12, 2024
ForEach<_StoreCollection, ObjectIdentifier, SingleTaskView>: the ID ObjectIdentifier(0x0000600003fe8b40) occurs multiple times within the collection, this will give undefined results!

from swift-composable-architecture.

Comments (2)

zhangpeibj01 avatar zhangpeibj01 commented on June 12, 2024

I logged state.todos and there were no identical ids.

from swift-composable-architecture.

stephencelis avatar stephencelis commented on June 12, 2024

@zhangpeibj01 In the upgrade guide we note that the 1:1 migration requires you to explicitly select the id from store state, otherwise ForEach will take the child store's object identifier:

https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/migratingto1.7#Replacing-ForEachStore-with-ForEach

So you should update your code for a true comparison:

 ForEach(
-  store.scope(state: \.tasks, action: \.tasks)
+  store.scope(state: \.tasks, action: \.tasks), id: \.state.id
 ) { store in
   SingleTaskView(store: store)
 }

I'm going to convert this to a discussion since it doesn't appear to be a bug with the library, but if you do think you've encountered a bug, please provide a sample project that reproduces the issue. Without it we won't be able to troubleshoot the problem.

from swift-composable-architecture.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.