feat(stories): collapse the block when there is nothing to show - #222
Merged
Conversation
A block switched off in the dashboard loads without stories, and the widget kept its 135pt row anyway — an empty gap on the host screen. It now hides itself, reports a zero intrinsic height and activates a zero-height constraint; a failed load collapses the same way instead of leaving the placeholder row shimmering for good. A later load with stories brings it back. Hosts that pin the height with a required constraint or lay the block out by frame keep control and react through the new `onStoriesCollapse` / `hasStories`; the SwiftUI wrapper drops its own frame to zero and exposes `onCollapse`. Also closes a crash the empty block exposed: the loaded list was assigned off the main queue while the placeholder row still asked for 4 cells, so the subscript trapped on a shorter or empty list.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DEV-T-370: a stories block switched off in the dashboard loaded empty and still took up its 135pt row.
StoriesViewhides itself and reports a zero height when there is nothing to show. A failed load collapses the same way; a later load with stories brings the block back.hasStories,onStoriesCollapse,StoriesView.defaultHeight,StoriesWidget.onCollapse(_:). Nothing removed — minor bump.Index out of rangecrash the empty block exposed: the loaded list is handed to the collection view on the main queue and read with bounds checks.Hosts that pin the height themselves keep control and react through
onStoriesCollapse.