Skip to content

Paginate set contributions instead of embedding them - #40

Open
jckbtchr-vv wants to merge 1 commit into
mainfrom
feature/paginate-participation-images
Open

Paginate set contributions instead of embedding them#40
jckbtchr-vv wants to merge 1 commit into
mainfrom
feature/paginate-participation-images

Conversation

@jckbtchr-vv

Copy link
Copy Markdown
Member

The problem

GET /v1/set-submissions/:uuid returns 5,036,026 bytes (4.8MB) for 11x11.

98% of that is participationImages: 3,213 rows, each preloading its image, its creator, and the creator's pfp. Strip them and the same response is 99KB.

The client already virtualises the contributions grid, so this was never a render cost. It is transfer, paid by every visitor before the page can paint, and again on the frontend's refresh interval.

The change

participationImages is now embedded only when asked for, using the existing includes convention from OpepenController:

GET /v1/set-submissions/:uuid?includes[]=participationImages

This is non-breaking by default. Any consumer that needs them can opt back in with no other change.

Two routes added alongside, following the pagination pattern in AccountsController (page / limit / filter / sort):

GET /v1/set-submissions/:uuid/participation
GET /v1/set-submissions/:uuid/participation-stats

filter[creatorAddress] pages a single artist's contributions. That is the piece we need to group the contributions grid by artist rather than showing one flat wall of 3,213 tiles.

participation-stats returns contribution and contributor counts so a client can size the list without fetching it.

Sequencing

The frontend currently reads participationImages off the submission response, so this should deploy before the frontend switches to the new route. Nothing breaks in the meantime: the field is simply absent unless requested, and the frontend change is a separate PR.

Not verified

I could not run the test suite. There is no .env in the repo and no local Postgres, so node ace test fails at boot on a missing APP_URL. The functional specs under tests/functional/ cover this controller area, and contributor/co-creator code has had three PRs in the last few weeks, so please run them before merging.

Typecheck passes with no new errors (the one @visualizevalue/img-grid error is present on clean main too).

GET /v1/set-submissions/:uuid returned 4.8MB for a busy set. 98% of that
was participationImages: 3,213 rows, each preloading its image, its
creator and the creator's pfp. Without them the same response is 99KB.

The client already virtualises the contributions grid, so this was never
a render cost. It was transfer, paid by every visitor before the page
could paint, and again on the frontend's refresh interval.

participationImages is now only embedded when asked for
(?includes[]=participationImages), so existing consumers can opt back in
unchanged. New alongside it:

  GET /v1/set-submissions/:uuid/participation
      page, limit, filter, sort. filter[creatorAddress] pages a single
      artist's contributions, which is what grouping the grid by artist
      needs.

  GET /v1/set-submissions/:uuid/participation-stats
      contribution and contributor counts, so a client can size the list
      without fetching it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

1 participant