Comments (2)
This doesn't really make sense. The whole point of calling performBatchUpdates for every single update is to ensure it enqueues those correctly. So it shouldn't be possible to NOT have index-0
. That being said I do remember reading somewhere that the call to performBatchUpdates
is sync
while the internal execution is async
. So it'll return immediately but potentially execute later. I believe this is to ensure you can call this quite rapidly without issue.
The most common cause of issues here is usually the data being out of sick. Are you updating the model inside the performBatchUpdates
as well, you should be?
from composed.
The most common cause of issues here is usually the data being out of sick. Are you updating the model inside the
performBatchUpdates
as well, you should be?
Moving to the closure-based design is aimed to ensure that the models are updated inside performBatchUpdates
(Composed is currently not guaranteeing this).
One way this crash seems to happen is when the configuration of a header (possibly cells, I've not tested this yet) triggers an update. This is probably impossible to support without capturing the updates
closure and I think should be classed as a misuse of the API (note that I wrote part of this 😬).
The workaround I've found (after a few separate debugging sessions) is to invalidate all if this scenario is detected:
performBatchUpdates
has been called on the collection view- All updates have been applied to the collection view
After the updates have been applied the collection will layout, dequeuing views as necessary. If any of these views then trigger an update it will enter CollectionCoordinator.mapping(_:willPerformBatchUpdates:)
again, so the logs make sense now.
I've added a long print
statement when this happens so consumers can debug this a little easier. Invalidating everything fixes the crash so I think this is a good compromise?
At first I thought this might work because collection view apparently supports nested batch updates:
But I would guess their logic is along the lines of:
- Call
updates
- Dequeue views
- Commit changes
- async wait for animations
- Call completion
Because the crash is essentially:
- Call
updates
updates
inserts0,0
- Dequeue views
- Dequeuing deletes
0,0
- Dequeuing deletes
- Crash because
0,0
doesn't exist
from composed.
Related Issues (10)
- Project is unlicenced HOT 3
- Adding `Suspendible` support HOT 8
- [BUG] HOT 1
- Improve extensions for RandomAccessCollection HOT 5
- Merge Composed, ComposedUI, and ComposedLayouts packages HOT 14
- How to use `ComposedSectionProvider` with `Section`s that update? HOT 4
- `CollectionCoordinatorDelegate`'s background view does not behave as documented HOT 9
- Implement Drag and Drop API support HOT 1
- Implement reordering API HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from composed.