Skip to content

Refactor authentication and improve discussion loading logic - #7

Merged
NotReeceHarris merged 1 commit into
mainfrom
develop/optimisation
Jul 19, 2026
Merged

NotReeceHarris merged 1 commit into
mainfrom
develop/optimisation

Conversation

@NotReeceHarris

Copy link
Copy Markdown
Owner

This pull request introduces a stale-while-revalidate (SWR) cache for GraphQL responses, adds a test coverage summary comment to pull requests, and improves configurability and efficiency of forum data fetching. It also refines several naming and configuration conventions for consistency. The most important changes are grouped and summarized below:

Caching and Data Fetching Improvements:

  • Added a robust SWR cache in src/lib/cache.ts for GraphQL data, with user-scoping, versioning, TTL, and quota management. This enables instant page loads from localStorage and background revalidation, configurable via the new cache section in forum.config.ts. [1] [2] [3]
  • Refactored forum data fetching in src/lib/github/api.ts to load categories, user permissions, and the first page of discussions in a single request (getOverview), reducing load time and redundant requests. [1] [2]

Configuration and Feature Flags:

  • Added listExcerpts to the content config, allowing forums to disable body excerpts in discussion lists for smaller payloads; updated related logic and documentation. (Fc493ad4L91R91, [1] [2]
  • Introduced a cache config section with enabled and ttlSeconds options for controlling the new SWR cache. [1] [2] [3]

CI and Developer Experience:

  • Updated the GitHub Actions workflow to comment a formatted test coverage table on pull requests, improving visibility into test quality. [1] [2]

Consistency and Naming:

  • Standardized project-specific prefixes from gf: to dk: across theme storage, article markers, and sign-in token fields for clarity and branding consistency. [1] [2] [3] [4]

Component and API Improvements:

  • Improved the reply posting flow in CommentCard.svelte by returning the created reply object to the parent component, enabling immediate UI updates. [1] [2] [3]

Let me know if you'd like a deeper dive into any specific change!

feat: modify discussion body type to be optional for excerpts and articles

refactor: consolidate loading of categories, viewer permissions, and home feed into a single overview function

fix: adjust page loading logic to utilize shared home feed data

feat: implement caching strategies for discussion loading and user-specific data

fix: enhance comment posting to update discussion state without full refetch

test: add comprehensive tests for cache functionality and user scoping

test: update tests to reflect changes in token and state key usage

test: ensure UI tests validate new overview loading logic and theme persistence

chore: update vitest configuration to include JSON summary reporting
@NotReeceHarris NotReeceHarris self-assigned this Jul 19, 2026
@NotReeceHarris NotReeceHarris added the enhancement New feature or request label Jul 19, 2026
@github-actions

Copy link
Copy Markdown

🧪 Test coverage

File                           Stmts %  Branch %  Funcs %  Lines %
-----------------------------  -------  --------  -------  -------
oauth-proxy/worker.js              100       100      100      100
src/lib/cache.ts                   100       100      100      100
src/lib/config/index.ts            100       100      100      100
src/lib/config/schema.ts           100       100      100      100
src/lib/github/api.ts              100       100      100      100
src/lib/github/auth.svelte.ts      100       100      100      100
src/lib/ui.svelte.ts               100       100      100      100
src/lib/utils.ts                   100       100      100      100
TOTAL                              100       100      100      100

@NotReeceHarris
NotReeceHarris merged commit 2f34d5e into main Jul 19, 2026
1 check passed
@NotReeceHarris
NotReeceHarris deleted the develop/optimisation branch July 19, 2026 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant