thread / composed Goto Github PK
View Code? Open in Web Editor NEWComposable DataSources
Composable DataSources
I have a feeling this will also crash with a regular remove(dataSource:)
call for the last section, but this is how I came across it.
ComposedDataSource.removeAll
calls updateDelegate?.dataSource(self, didDeleteSections: IndexSet(indexes))
on line 164, which triggers collectionView.collectionViewLayout.layoutAttributesForElements(in: collectionView.bounds)
in CollectionViewWrapper
.
FlowLayout
is then queried, but the collection view and the data sources are out-of-sync. The collection view thinks it has more than 0 sections, but they've actually just been deleted, so when backgroundViewClass(in:forSectionAt:)
is called it tries to get a mapping for a section that โ to the data source โ doesn't exist.
I've seen this on master
and performance
but my attempts to fix it have been fruitless :(
Attached is a screenshot of the stacktrace.
While trying to get ComposedDataSource
to work I noticed that the methods on DataSourceUpdateDelegate
seem to be somewhat duplicated.
At first I had assumed that I should use func dataSource(_ dataSource: DataSource, willPerform updates: [DataSourceUpdate])
and func dataSource(_ dataSource: DataSource, didPerform updates: [DataSourceUpdate])
, but then I noticed the func dataSource(_ dataSource: DataSource, did*)
functions.
Looking at DataSourceUpdate
it has equivalents for each of the func dataSource(_ dataSource: DataSource, did*)
functions. Do these have explicit different uses, or could they be consolidated? I saw that in CollectionViewWrapper
both functions are handled, but in the func dataSource(_ dataSource: DataSource, did*)
functions the messages are passed to the collection view, but in func dataSource(_ dataSource: DataSource, didPerform updates: [DataSourceUpdate])
only the placeholder is updated.
Using only the DataSourceUpdate
methods would maybe make implementations smaller (e.g. the message passing in SegmentedDataSource
would be much smaller), and would IMO be the better solution.
What do you think?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.