Skip to content

refactor: Co-locate the export graphql queries with their SFCs#2234

Open
wreality wants to merge 19 commits intomasterfrom
feature/colocated-fragments
Open

refactor: Co-locate the export graphql queries with their SFCs#2234
wreality wants to merge 19 commits intomasterfrom
feature/colocated-fragments

Conversation

@wreality
Copy link
Copy Markdown
Contributor

@wreality wreality commented Mar 14, 2026

Summary

  • Switch GraphQL codegen to client-preset and co-locate GraphQL fragments/queries in Vue SFCs for the export feature
  • Split the export flow into two routes: /export (options page) and /export/html (preview/download page), so each page owns its own queries
  • Consolidate ExportComment/ExportCommentList into ExportInlineComments and ExportOverallComments components
  • Extract export preview seeding into a dedicated ExportPreviewSeeder with a seeded submission for testing
  • Add specs for ExportParticipantSelector, SubmissionExport, SubmissionExportHtml, and ExportInlineComments/ExportOverallComments

Test plan

  • Run ExportParticipantSelector and SubmissionExport vitest specs
  • Run SubmissionExportHtml and export comment vitest specs
  • Seed the database and verify the export preview flow end-to-end
  • Verify /export options page navigates correctly to /export/html

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 14, 2026

Deploy Preview for pilcrow-docs ready!

Name Link
🔨 Latest commit fd10295
🔍 Latest deploy log https://app.netlify.com/projects/pilcrow-docs/deploys/69c3cdda1a7d600008cc0a1e
😎 Deploy Preview https://deploy-preview-2234--pilcrow-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@wreality wreality changed the base branch from master to feature/client-typescript-clean March 14, 2026 19:24
@wreality wreality force-pushed the feature/colocated-fragments branch from 46c8bde to fb24505 Compare March 17, 2026 18:44
@wreality wreality changed the base branch from feature/client-typescript-clean to master March 17, 2026 18:44
wreality added 11 commits March 20, 2026 10:08
Replace typescript/typescript-operations plugins with @graphql-codegen/client-preset.
Fragment masking is disabled (Apollo Client has native data masking).
This enables colocated fragment/query definitions in Vue SFCs using the
generated graphql() function and typed document imports.

Generated with LLM assistance
Define component-specific fragments using graphql() in <script> blocks:
- avatarImage, avatarBlock, userListBasicItem, userListBasic,
  userListItem, userList fragments on User type
- Colocate GetUsers query in UsersIndex.vue, import GetUsersDocument
- Replace broad User/relatedUserFieldsFragment props with narrower
  component-specific fragment types
- Convention: fragment name matches component name (camelCase)

Generated with LLM assistance
Documents the data fetching architecture (pages own queries, components
define fragments, pure UI has no GraphQL), naming conventions, type
guidelines, and the two-script-block pattern for Vue SFCs.

Generated with LLM assistance
Separate the export flow into two routes: /export for configuring
options (comment types, participant filters) and /export/html for
the actual preview/download. This resolves the convention violation
where SubmissionExportGenerator was calling queries directly instead
of the page owning them.

- Create SubmissionExportHtml page owning GetSubmissionExportData query
  and export comment fragments
- Simplify SubmissionExport to options-only (navigates to html page)
- Simplify SubmissionExportGenerator to pure renderer (no dialog, no query)
- Replace generated GraphQL types with plain ExportCommentBase interface
  in export components
- Remove trashed: WITH from export queries (deleted comments filtered
  in display, no need to fetch them)

Generated with LLM assistance
Colocate GraphQL fragments in export components (ExportContent,
ExportInlineComments, ExportOverallComments) on the Submission type.
Consolidate ExportComment/ExportCommentList into ExportInlineComments
and ExportOverallComments. Add form state persistence via URL query
params, auto-download support, and UI improvements to export pages.

Generated with LLM assistance
- Add missing @types/validator entry to client yarn.lock
- Add language specifier to fenced code block in graphql-client docs

Generated with LLM assistance
These pages are being replaced by the admin-tables branch.

Generated with LLM assistance
Superseded by admin-tables branch.

Generated with LLM assistance
- Inline commentFields/relatedUserFields fragment references into
  ExportInlineComments and ExportOverallComments, querying only the
  fields each component actually uses
- Remove deleted comment handling from export components
- Add seeded submission 113 (ACCEPTED_AS_FINAL) with inline and
  overall comments for export preview testing
- Fix hardcoded submission_id in OverallCommentSeeder.createCommentReply
- Update tests to match simplified fragment types

Generated with LLM assistance
…wSeeder

Move submission 113 creation and its comments out of SubmissionSeeder,
InlineCommentSeeder, and OverallCommentSeeder into a self-contained
ExportPreviewSeeder for better readability.

Generated with LLM assistance
@wreality wreality force-pushed the feature/colocated-fragments branch from 779ab85 to a1ee825 Compare March 20, 2026 14:26
The convention documentation isn't fully developed yet; removing it
from the branch to keep the PR focused on the implementation.
@wreality wreality changed the title Start co-locating graphql fragments with their consuming components refactor: Co-locate the export graphql queries with their SFCs Mar 20, 2026
@wreality wreality marked this pull request as ready for review March 20, 2026 16:42
@wreality wreality requested a review from gmeben March 20, 2026 16:46
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