Skip to content

Scroll to drop speedup#1861

Merged
simo6529 merged 2 commits intomainfrom
scroll-to-drop-speedup
Jan 29, 2026
Merged

Scroll to drop speedup#1861
simo6529 merged 2 commits intomainfrom
scroll-to-drop-speedup

Conversation

@simo6529
Copy link
Copy Markdown
Collaborator

@simo6529 simo6529 commented Jan 29, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Drops now support mentioning waves, with new data fields to track mentioned wave references.
    • New endpoint for retrieving drop identifiers with optimized pagination.
  • Chores

    • Enhanced API data structures to support drop mentions and improved metadata handling.
    • Removed deprecated artist-related API endpoints and schemas.
    • Optimized internal type definitions and data composition logic.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 29, 2026

📝 Walkthrough

Walkthrough

This PR refactors the light-drop representation from ApiLightDrop to a new ApiDropId type, introduces a new /drop-ids API endpoint for paginated drop ID fetching, extends drop structures with mentioned_waves support, and removes obsolete artist-related schemas. Components and hooks are updated to use the new type hierarchy, with pagination logic refactored to work with the lightweight drop ID objects.

Changes

Cohort / File(s) Summary
API Schema & Endpoint
openapi.yaml
Adds /drop-ids endpoint, introduces ApiDropId and ApiMentionedWave schemas, extends ApiDrop/ApiDropPart/ApiCreateDropPart with mentioned_waves field, removes artist-related schemas (ApiArtistItem, ApiArtistsNft, ApiArtistsPage, ApiArtistsWork).
Type Definitions & Helpers
helpers/waves/drop.helpers.ts
Introduces new LightDropSummary type (id + serial_no from ApiLightDrop with other fields optional), refactors ExtendedLightDrop to extend LightDropSummary instead of ApiLightDrop.
Context & Pagination Logic
contexts/wave/MyStreamContext.tsx, contexts/wave/hooks/useWavePagination.ts
Replaces ApiLightDrop with ApiDropId in type imports and return signatures, introduces isFullDrop type guard to distinguish full drops from light drops based on presence of wave field, updates pagination state and data handling logic accordingly.
Wave Messages Utility
contexts/wave/utils/wave-messages-utils.ts
Refactors fetchLightWaveMessages to fetch drop IDs from /drop-ids endpoint instead of full light drops, updated pagination parameters (min_serial_no), accumulates unique ApiDropId entries and merges with full ApiDrop entries by serial_no.
Component Updates
components/waves/CreateDropContent.tsx, components/waves/drops/LightDrop.tsx
Extends optimistic drop shape with mentioned_waves array per part, adds mentioned_users and metadata fields; updates LightDrop component to use LightDropSummary type instead of ApiLightDrop, reorders Tailwind classes without functional changes.
Tests & Scripts
__tests__/contexts/wave/utils/wave-messages-utils.additional.test.ts, scripts/quality.js
Updates mock batch data to include id field, changes endpoint from light-drops to drop-ids, adjusts test expectations (serial ranges, result lengths); comments out branch-behind check in quality script.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

Possibly related PRs

  • Designated payee #1733: Modifies helpers/waves/drop.helpers.ts with light/full drop type reshaping and preview-image helpers, affecting the same type hierarchy being refactored here.
  • Unread divider fix #1688: Updates drop-related types and signatures in contexts/wave/MyStreamContext.tsx, overlapping with context interface changes in this PR.

Suggested reviewers

  • prxt6529
  • ragnep

Poem

🐰 A hop through types, a fresh design,
Drop IDs shine in columns fine,
Waves mentioned now, from end to start,
This refactor shows the craftsman's art!

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The PR title 'Scroll to drop speedup' is vague and does not clearly summarize the actual changes, which involve replacing ApiLightDrop with ApiDropId, adding mentioned_waves support, and refactoring API endpoints. Consider a more descriptive title that reflects the main changes, such as 'Replace ApiLightDrop with ApiDropId and add mentioned_waves support' or 'Refactor drop pagination to use drop-ids endpoint'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jan 29, 2026

Quality Gate Passed Quality Gate passed

Issues
0 New issues
3 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@contexts/wave/utils/wave-messages-utils.ts`:
- Around line 437-439: The current falsy check on apiParams.min_serial_no
rejects valid value 0; change the guard so it only throws when min_serial_no is
missing (null or undefined). Replace the if (!apiParams.min_serial_no) check
with a strict existence check (e.g., test for null/undefined) so
apiParams.min_serial_no === 0 is allowed, and keep the same Error("min_serial_no
is required in apiParams") behavior when the value is absent.

In `@openapi.yaml`:
- Around line 889-934: Update the OpenAPI /drop-ids operation to add clear
descriptions for the min_serial_no and max_serial_no query parameters: state
that min_serial_no is the inclusive lower bound (serial >= min_serial_no),
max_serial_no is the inclusive upper bound (serial <= max_serial_no) and that
max_serial_no is optional; also document that results are ordered ascending by
serial number and that the limit parameter defaults to 100 (max 5000) to clarify
pagination behavior for consumers. Reference: /drop-ids, parameters
min_serial_no, max_serial_no, and limit.
🧹 Nitpick comments (2)
scripts/quality.js (1)

186-190: Clarify intent: remove or restore the branch-behind check.

Commenting out code rather than removing it leaves dead code in the codebase. If this change is:

  • Temporary: Add a TODO or FIXME comment explaining why it's disabled and when it should be re-enabled.
  • Permanent: Remove the commented block entirely to keep the codebase clean.

Additionally, disabling this check allows branches that are behind main to pass quality gates, which could lead to merge conflicts or integration issues. Consider whether this aligns with your team's workflow expectations.

components/waves/drops/LightDrop.tsx (1)

4-8: Unused drop prop in component.

The drop prop is declared in LightDropProps but never used in the component. The component renders a static skeleton placeholder regardless of the drop data passed to it.

If this is intentional (e.g., the prop is for future use or type consistency with other components), consider prefixing with underscore or adding a comment. Otherwise, remove the unused prop.

♻️ Option 1: If prop is needed for type consistency but intentionally unused
-const LightDrop: FC<LightDropProps> = () => {
+const LightDrop: FC<LightDropProps> = (_props) => {

Or simply remove the prop if it's not needed:

-interface LightDropProps {
-  readonly drop: LightDropSummary;
-}
-
-const LightDrop: FC<LightDropProps> = () => {
+const LightDrop: FC = () => {

Comment thread contexts/wave/utils/wave-messages-utils.ts
Comment thread openapi.yaml
@simo6529 simo6529 merged commit cf81329 into main Jan 29, 2026
7 checks passed
@simo6529 simo6529 deleted the scroll-to-drop-speedup branch January 29, 2026 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants