ephraimduncan / ephraimduncan/blocks
[Bug/Enhancement] Block component resizing logic and performance optimizations
- Dominant language
- TypeScript
- Stars
- 1.8k
- Forks
- 162
- Avg merge
- 3h 11m
- Merged PRs (30d)
- 18
Description
While using the **Block** component, I noticed that the ToggleGroup for device sizes (Desktop/Tablet/Mobile) does not correctly trigger the resizable panels. Additionally, rendering multiple blocks causes performance degradation because all iframes load simultaneously.
Proposed Fixes:
- Use native IntersectionObserver for lightweight lazy-loading.
- Use PanelImperativeHandle to fix the handleSizeChange logic.
- Add a Skeleton and onLoad state to the iframe to prevent layout shift.
- Implement React.memo and useCallback to prevent unnecessary re-renders during scaling.
Contributor guide
Research direction
The entry point is the Block component; start by tracing the device-size ToggleGroup through handleSizeChange and the iframe rendering path. Review the proposed IntersectionObserver, PanelImperativeHandle, Skeleton, onLoad, React.memo, and useCallback changes together. Done means resizing works for all device sizes, multiple blocks avoid simultaneous iframe loading, and loading does not cause layout shift.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100