Skip to content

Comments

Add caching mechanism for initial batch of rules by author#2477

Merged
Freego1783 merged 4 commits intomainfrom
2468-cache-first-batch
Feb 24, 2026
Merged

Add caching mechanism for initial batch of rules by author#2477
Freego1783 merged 4 commits intomainfrom
2468-cache-first-batch

Conversation

@Aibono1225
Copy link
Member

@Aibono1225 Aibono1225 commented Feb 23, 2026

#2468

This pull request introduces caching and pagination improvements to the "rules by author" API endpoint and applies a new limit to the number of authored rules fetched on the user client page. The main goal is to optimize performance by caching the first batch of results and to prevent excessive data fetching on the client side.

@SSWConsulting SSWConsulting deleted a comment from github-actions bot Feb 23, 2026
@SSWConsulting SSWConsulting deleted a comment from github-actions bot Feb 23, 2026
@SSWConsulting SSWConsulting deleted a comment from github-actions bot Feb 24, 2026
@Aibono1225
Copy link
Member Author

/deploy

@github-actions
Copy link
Contributor

PR Preview Deployed

Preview URL https://app-sswrules-staging-pr-2477.azurewebsites.net/rules
Slot Name pr-2477
Branch 2468-cache-first-batch
Commit f8f535bacb7e827a3fb148d3c4c07a79fb1273c0

This preview will be automatically deleted when the PR is closed.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request implements a caching mechanism for the first batch of rules fetched by author in the user profile page. The changes optimize performance by caching the initial 20 rules for each author with a 24-hour TTL and stale-while-revalidate strategy, while also adding a 100-rule limit on the client side to prevent excessive data fetching.

Changes:

  • Add server-side caching for the first batch (20 rules) of author rules with 24-hour cache duration
  • Implement Cache-Control headers with stale-while-revalidate for CDN/browser caching
  • Add MAX_AUTHORED_RULES limit (100) on client to cap the total rules fetched per author

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

File Description
app/api/tina/rules-by-author/route.ts Implements Next.js unstable_cache for first batch of author rules with conditional caching based on environment and request parameters
app/user/client-page.tsx Adds MAX_AUTHORED_RULES constant and loop termination logic to limit authored rules fetching to 100 rules

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Freego1783 Freego1783 merged commit ac2b268 into main Feb 24, 2026
4 checks passed
@Freego1783 Freego1783 deleted the 2468-cache-first-batch branch February 24, 2026 13:17
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