feat: use-project-id-from-context
Thanks for submitting a PR! Please check the boxes below:
- [ ] I have added information to
docs/if required so people know about the feature! - [ ] I have filled in the "Changes" section below?
- [ ] I have filled in the "How did you test this code" section below?
- [ ] I have used a Conventional Commit title for this Pull Request
Changes
The objective of this PR is to provide a single source for current projectId/environmentId/organisationId (based on url)
How did you test this code?
Please describe.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| flagsmith-frontend-preview | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jun 27, 2025 2:35pm |
| flagsmith-frontend-staging | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jun 27, 2025 2:35pm |
1 Skipped Deployment
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| docs | ⬜️ Ignored (Inspect) | Visit Preview | Jun 27, 2025 2:35pm |
Docker builds report
| Image | Build Status | Security report |
|---|---|---|
ghcr.io/flagsmith/flagsmith-api-test:pr-5547 |
Finished :white_check_mark: | Skipped |
ghcr.io/flagsmith/flagsmith-e2e:pr-5547 |
Finished :white_check_mark: | Skipped |
ghcr.io/flagsmith/flagsmith-api:pr-5547 |
Finished :white_check_mark: | Results :white_check_mark: |
ghcr.io/flagsmith/flagsmith:pr-5547 |
Finished :white_check_mark: | Results :white_check_mark: |
ghcr.io/flagsmith/flagsmith-private-cloud:pr-5547 |
Finished :white_check_mark: | Results :white_check_mark: |
ghcr.io/flagsmith/flagsmith-frontend:pr-5547 |
Finished :white_check_mark: | Results :white_check_mark: |
I tested and it works without any issues. Is the idea using useRouteContext instead of useParams and useRouteMatch ?
Yes that would be the idea. Especially for projectId (less important for environmentID being a string). So it's accessible from only one place instead of having an util or dealing with the type every time
Yes that would be the idea. Especially for projectId (less important for environmentID being a string). So it's accessible from only one place instead of having an util or dealing with the type every time
Ok, can you create a ticket for replacing every place that's using useParams and useRouteMatch for pulling projectId, environmentId and organisationId?
Did it directly in this PR but I'll create a ticket to re-type the component using it as a string