flagsmith icon indicating copy to clipboard operation
flagsmith copied to clipboard

feat: use-project-id-from-context

Open Zaimwa9 opened this issue 8 months ago • 2 comments

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.

Zaimwa9 avatar Jun 05 '25 21:06 Zaimwa9

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

vercel[bot] avatar Jun 05 '25 21:06 vercel[bot]

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:

github-actions[bot] avatar Jun 05 '25 21:06 github-actions[bot]

I tested and it works without any issues. Is the idea using useRouteContext instead of useParams and useRouteMatch ?

tiagoapolo avatar Jun 26 '25 12:06 tiagoapolo

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

Zaimwa9 avatar Jun 26 '25 13:06 Zaimwa9

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?

tiagoapolo avatar Jun 26 '25 13:06 tiagoapolo

Did it directly in this PR but I'll create a ticket to re-type the component using it as a string

Zaimwa9 avatar Jun 27 '25 13:06 Zaimwa9