Skip to content

Conversation

@graycreate
Copy link
Member

Summary

Add minimum height placeholder for the topic content area while content is rendering to prevent layout jumps.

Changes

  • Add contentReady state to track when RichContentView finishes rendering
  • Use onRenderCompleted callback to detect render completion
  • Apply 60% screen height as minimum height while loading
  • Animate transition to actual content height when ready

Test plan

  • Open a topic detail page
  • Observe that content area maintains stable height during loading
  • Verify smooth transition when content renders
  • Confirm no layout jumps occur

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings December 29, 2025 00:52
@graycreate graycreate force-pushed the feature/content-placeholder-height branch from 785390d to 5e38467 Compare December 29, 2025 00:54
@github-actions github-actions bot added size/XS and removed size/XS labels Dec 29, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a placeholder height mechanism to the topic content area to prevent layout jumps during content rendering. The implementation introduces state tracking to detect when RichContentView completes rendering and applies a minimum height constraint that transitions away once content is ready.

Key Changes

  • Introduces contentReady state to track RichContentView rendering completion
  • Utilizes the onRenderCompleted callback to detect when content finishes rendering
  • Applies a 60% screen height minimum constraint while loading, transitioning to actual content height

}
.padding(.horizontal, 12)
.padding(.vertical, 8)
.frame(minHeight: contentReady ? 0 : UIScreen.main.bounds.height)
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using UIScreen.main.bounds directly in SwiftUI is not the recommended approach and can cause issues with multitasking on iPad, scene-based apps, and dynamic sizing. The preferred approach is to use GeometryReader to get the size of the containing view. Replace UIScreen.main.bounds.height * 0.6 with a GeometryReader-based solution to get the proper container height.

Copilot uses AI. Check for mistakes.
Comment on lines 44 to 50
withAnimation(.easeInOut(duration: 0.2)) {
contentReady = true
}
}
.padding(.horizontal, 12)
.padding(.vertical, 8)
.frame(minHeight: contentReady ? 0 : UIScreen.main.bounds.height)
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The animation wrapper around the state change in onRenderCompleted will not animate the frame transition. The withAnimation block animates the state change itself, but the frame modifier on line 50 doesn't implicitly animate. To achieve smooth height transition, either remove the withAnimation wrapper (since the frame change will be instantaneous anyway) or move the animation modifier to the frame itself using .animation(.easeInOut(duration: 0.2), value: contentReady) after the frame modifier.

Suggested change
withAnimation(.easeInOut(duration: 0.2)) {
contentReady = true
}
}
.padding(.horizontal, 12)
.padding(.vertical, 8)
.frame(minHeight: contentReady ? 0 : UIScreen.main.bounds.height)
contentReady = true
}
.padding(.horizontal, 12)
.padding(.vertical, 8)
.frame(minHeight: contentReady ? 0 : UIScreen.main.bounds.height)
.animation(.easeInOut(duration: 0.2), value: contentReady)

Copilot uses AI. Check for mistakes.
@github-actions
Copy link

Code Coverage Report ❌

Current coverage: 0%

Hide postscripts and reply sections until topic content finishes rendering:
- Add onContentReady callback to NewsContentView
- Add contentReady state to FeedDetailPage
- Show postscripts and replies only after content renders (or if no content)
- Smooth animation when sections appear

This prevents seeing reply section while content is still loading.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@graycreate graycreate force-pushed the feature/content-placeholder-height branch from 5e38467 to 3a1056c Compare December 29, 2025 00:57
@graycreate graycreate merged commit efff2d3 into main Dec 29, 2025
@graycreate graycreate deleted the feature/content-placeholder-height branch December 29, 2025 00:58
@github-actions github-actions bot added size/M and removed size/XS labels Dec 29, 2025
@github-actions
Copy link

Code Coverage Report ❌

Current coverage: 33.79%

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants