Skip to content

Crash when adding a section before view appears #8

Description

@JosephDuffy

Describe the bug

When adding a section to a ComposedSectionProvider in a viewDidLoadafter the CollectionCoordinator has been set as the delegate but before the view has appeared the coordinator will fatalError in elementsProvider(for:) with error Fatal error: No UI configuration available for section 2.

To Reproduce

  1. Checkout https://github.com/composed-swift/Composed-Demo/tree/ComposedSectionProvider-crash-example
  2. Uncomment https://github.com/composed-swift/Composed-Demo/blob/ComposedSectionProvider-crash-example/Composed-Demo/Collection/PeopleCollectionViewController.swift#L20

Expected behavior

Should not crash

Environment

  • OS Version: iOS 13.5, iOS 14 beta 7
  • Library Version: 1.0.2
  • Device: iPhone 8 Simulator

Additional context

The crash is triggered by collectionView.performBatchUpdates, but the closure is never executed so prepareSections never gets a chance to be called.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions