chore: add source section comments#47
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #47 +/- ##
===========================================
- Coverage 100.00% 99.51% -0.49%
===========================================
Files 8 8
Lines 201 207 +6
Branches 55 62 +7
===========================================
+ Hits 201 206 +5
- Misses 0 1 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code Review
This pull request introduces standardized section headers across multiple files to improve code organization by categorizing elements like Types, Props, and Render logic. The review feedback suggests that these headers may be redundant in small re-export files, such as index.ts, where they add visual noise. Additionally, it was noted that using these headers to mark internal logic steps within hooks like useFlattenRows.ts is inconsistent with the top-level categorization used elsewhere in the project.
| // ============================== Types =============================== | ||
| export type { ListyRef, ListyProps } from './List'; | ||
|
|
||
| // ============================== Export ============================== | ||
| export default Listy; |
There was a problem hiding this comment.
Adding section comments to a very small re-export file like index.ts introduces unnecessary visual noise. These headers are more effective in larger files with distinct logical sections (as seen in List.tsx).
| // ============================== Types =============================== | |
| export type { ListyRef, ListyProps } from './List'; | |
| // ============================== Export ============================== | |
| export default Listy; | |
| export type { ListyRef, ListyProps } from './List'; | |
| export default Listy; |
| @@ -22,10 +23,12 @@ export default function useFlattenRows<T, K extends React.Key = React.Key>( | |||
| group?: Group<T, K>, | |||
| ): FlattenRowsResult<T, K> { | |||
| return React.useMemo(() => { | |||
| // ============================== Init ================================ | |||
There was a problem hiding this comment.
The section headers here are used to mark internal logic steps within a useMemo block, which differs from the granularity established in List.tsx (where headers delineate top-level component sections). For consistency with the referenced style, consider removing these internal labels or using standard comments if clarification is needed.
Summary
srcfollowing the existingList.tsxseparator style, including extra notes for virtual sticky header rendering and scroll handling.List.tsxby sharing the forwardedrefthroughsharedListProps, returning the selected list directly, and using the shortervirtual ? VirtualList : RawListbranch.useFlattenRowsintosrc/VirtualListbecause it is only used by the virtual list implementation.scrollTo({ key, align: 'top' }), write it to an item CSS variable, and remove the eagerResizeObserverbookkeeping.Impact
This keeps the public API unchanged while making the source easier to scan and reducing RawList's sticky scroll bookkeeping.
Validation
ut run lintut run test -- --runInBand