Add locale as a query parameter to /app/projects API calls
Include locale in API calls to prevent caching issues when the locale changes, ensuring the correct response is fetched based on the current locale.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Updated (UTC) |
|---|---|---|---|
| planet-webapp-multi-tenancy-setup | ✅ Ready (Inspect) | Visit Preview | May 22, 2025 8:58am |
Walkthrough
This change updates multiple project-related components and contexts to include both the current tenant ID and locale as query parameters in their API requests. This ensures browser caching is effectively broken when either the tenant or locale changes. The effect hook dependencies are also updated accordingly. No other logic, control flow, or exported interfaces are altered.
Changes
| File(s) | Change Summary |
|---|---|
| src/features/projectsV2/ProjectDetails/index.tsx | Adds tenant ID (tenantConfig.id) as a query parameter to the project details API call; updates effect dependencies to include tenant ID. |
| src/features/projectsV2/ProjectsContext.tsx | Adds tenant ID as a query parameter to the projects list API call; updates effect dependencies to include tenant ID. |
| src/features/user/Widget/DonationLink/index.tsx | Adds explicit typing for API response (MapProject[]), changes tenant ID access to direct property, and adds tenant and locale query parameters to break cache. |
| src/tenants/salesforce/Mangroves/components/ProjectGrid.tsx | Adds locale as a query parameter to the projects API call for cache busting; imports and uses useLocale. |
| src/tenants/salesforce/OceanforceCampaign/components/ContentSection.tsx | Adds tenant ID and locale as query parameters in project data API call; updates effect dependencies to include tenant ID and locale. |
| src/tenants/salesforce/VTOCampaign2023/components/ProjectGrid.tsx | Adds tenant ID and locale as query parameters; explicitly types API response as MapProject[]; removes type assertion on setProjects. |
| src/tenants/salesforce/VTOCampaign2024/components/ProjectGrid.tsx | Adds tenant ID and locale as query parameters; explicitly types API response as MapProject[]; removes type assertion on setProjects. |
| src/tenants/salesforce/VTOCampaign2025/components/ProjectGrid.tsx | Adds locale as a query parameter; explicitly types API response as MapProject[]; removes type assertion on setProjects. |
Poem
🐇 Hopping through code with a tenant and locale,
Breaking old caches wherever they go.
Queries now fresh, no stale data in sight,
Fetching new projects, all shiny and bright.
With every new hop, the data’s brand new—
A rabbit’s delight in the code we pursue! 🥕✨
[!NOTE]
⚡️ AI Code Reviews for VS Code, Cursor, Windsurf
CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. Learn more here.
[!NOTE]
⚡️ Faster reviews with caching
CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 30th. To opt out, configure
Review - Disable Cacheat either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off theData Retentionsetting under your Organization Settings. Enjoy the performance boost—your workflow just got faster.
📜 Recent review details
Configuration used: CodeRabbit UI Review profile: CHILL Plan: Pro Cache: Disabled due to data retention organization setting Knowledge Base: Disabled due to data retention organization setting
📥 Commits
Reviewing files that changed from the base of the PR and between 7532a5f6213ffaf965267e48bf07e4eb821e9db0 and a56d815216f02ff81abd2407d7618334ff02e506.
📒 Files selected for processing (8)
src/features/projectsV2/ProjectDetails/index.tsx(4 hunks)src/features/projectsV2/ProjectsContext.tsx(4 hunks)src/features/user/Widget/DonationLink/index.tsx(2 hunks)src/tenants/salesforce/Mangroves/components/ProjectGrid.tsx(3 hunks)src/tenants/salesforce/OceanforceCampaign/components/ContentSection.tsx(3 hunks)src/tenants/salesforce/VTOCampaign2023/components/ProjectGrid.tsx(1 hunks)src/tenants/salesforce/VTOCampaign2024/components/ProjectGrid.tsx(1 hunks)src/tenants/salesforce/VTOCampaign2025/components/ProjectGrid.tsx(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- src/features/projectsV2/ProjectDetails/index.tsx
- src/features/projectsV2/ProjectsContext.tsx
🧰 Additional context used
🧬 Code Graph Analysis (4)
src/tenants/salesforce/OceanforceCampaign/components/ContentSection.tsx (1)
src/hooks/useApi.ts (1)
useApi(93-321)
src/tenants/salesforce/VTOCampaign2025/components/ProjectGrid.tsx (3)
src/tenants/salesforce/VTOCampaign2024/components/ProjectGrid.tsx (1)
ProjectGrid(15-86)src/hooks/useApi.ts (1)
useApi(93-321)src/features/common/types/projectv2.d.ts (1)
MapProject(20-20)
src/features/user/Widget/DonationLink/index.tsx (1)
src/features/common/types/projectv2.d.ts (1)
MapProject(20-20)
src/tenants/salesforce/VTOCampaign2023/components/ProjectGrid.tsx (3)
src/tenants/salesforce/VTOCampaign2025/components/ProjectGrid.tsx (1)
ProjectGrid(15-85)src/hooks/useApi.ts (1)
useApi(93-321)src/features/common/types/projectv2.d.ts (1)
MapProject(20-20)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: ESLint on Ubuntu
- GitHub Check: Analyze (javascript)
🔇 Additional comments (20)
src/tenants/salesforce/Mangroves/components/ProjectGrid.tsx (3)
12-13: Import change looks good.Adding the
useLocalehook from next-intl is necessary to access the current locale.
32-33: Locale usage implementation looks good.Adding the locale to be used in the API request is consistent with the PR objective.
46-48: Good cache-busting implementation with clear comment.The comment clearly explains why locale is being added as a query parameter: to break browser caching when locale changes.
src/tenants/salesforce/VTOCampaign2025/components/ProjectGrid.tsx (4)
12-13: Import change looks good.Adding the
useLocalehook from next-intl is necessary to access the current locale.
17-18: Locale usage implementation looks good.Adding the locale to be used in the API request is consistent with the PR objective.
26-26: Type annotation improvement.Adding the generic type parameter
<MapProject[]>to the getApi call improves type safety.
30-31: Good cache-busting implementation.Adding locale as a query parameter helps break browser caching when locale changes.
src/tenants/salesforce/OceanforceCampaign/components/ContentSection.tsx (4)
14-16: Import changes look good.Adding the
useLocalehook from next-intl anduseTenantfrom tenant context is necessary for accessing the current locale and tenant configuration.
22-24: Locale and tenant usage implementation looks good.Adding the locale and tenant config to be used in the API request is consistent with the PR objective.
38-39: Good cache-busting implementation.Adding locale and tenant as query parameters helps break browser caching when locale or tenant changes.
51-51: Excellent dependency array update.The
useEffectdependency array correctly includeslocaleandtenantConfig.id, ensuring that project data is reloaded when either changes. This is important for the cache-busting mechanism to work properly.src/features/user/Widget/DonationLink/index.tsx (3)
2-3: Type import looks good.Adding the import for the
MapProjecttype from projectv2 improves type safety in the API call.
27-27: Type annotation improvement.Adding the generic type parameter
<MapProject[]>to the getApi call improves type safety.
31-33: Good cache-busting implementation with clear comment.The comment clearly explains why locale and tenant are being added as query parameters: to break browser caching when locale changes.
src/tenants/salesforce/VTOCampaign2023/components/ProjectGrid.tsx (3)
12-13: Good addition of locale and tenant hooks.These imports allow the component to access the current locale and tenant information, which is essential for the API request parameters.
17-18: Properly initialized hooks for locale and tenant.Using these hooks is the appropriate way to access the current locale and tenant configuration.
26-35: API request now includes locale parameter to prevent caching issues.The addition of locale and tenant parameters to the API request aligns with the PR objective of preventing caching issues when locale changes. The explicit typing of
getApi<MapProject[]>is also good practice.However, the dependency array in the useEffect hook is empty, which means the API call won't be triggered when locale or tenantConfig changes. Consider updating it:
}, []); + }, [locale, tenantConfig.id, getApi, setErrors, redirect]);This ensures fresh data is fetched when the locale or tenant changes, fully addressing the caching issue mentioned in the PR objectives.
src/tenants/salesforce/VTOCampaign2024/components/ProjectGrid.tsx (3)
12-13: Good addition of locale and tenant hooks.These imports allow the component to access the current locale and tenant information, which is essential for the API request parameters.
17-18: Properly initialized hooks for locale and tenant.Using these hooks is the appropriate way to access the current locale and tenant configuration.
26-35: API request now includes locale parameter to prevent caching issues.The addition of locale and tenant parameters to the API request aligns with the PR objective of preventing caching issues when locale changes. The explicit typing of
getApi<MapProject[]>is also good practice.However, the dependency array in the useEffect hook is empty, which means the API call won't be triggered when locale or tenantConfig changes. Consider updating it:
}, []); + }, [locale, tenantConfig.id, getApi, setErrors, redirect]);This ensures fresh data is fetched when the locale or tenant changes, fully addressing the caching issue mentioned in the PR objectives.
✨ 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.
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>, please review it.Explain this complex logic.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai explain this code block.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read src/utils.ts and explain its main purpose.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR.@coderabbitai generate sequence diagramto generate a sequence diagram of the changes in this PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
@mariahosfeld Have updated this PR, this should resolve the project data caching issue.
@mohitb35 When I opened the deployment link, I encountered the error below. Could you please address this?
@mohitb35 When I opened the deployment link, I encountered the error below. Could you please address this?
Fixed, the error was related to the new header config. Merging from develop fixed the issue.
