GithubHelp home page GithubHelp logo

composed's People

Contributors

josephduffy avatar shaps80 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

ldt25290

composed's Issues

Crash when calling `ComposedDataSource.removeAll`

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.

image

DataSourceUpdateDelegate functions could be consolidated?

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?

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.