Skip to content

Fix privacy center routing issue#7549

Merged
jpople merged 2 commits intomainfrom
jpople/eng-2869/privacy-center-routing
Mar 3, 2026
Merged

Fix privacy center routing issue#7549
jpople merged 2 commits intomainfrom
jpople/eng-2869/privacy-center-routing

Conversation

@jpople
Copy link
Copy Markdown
Contributor

@jpople jpople commented Mar 3, 2026

Ticket ENG-2869

Description Of Changes

The privacy center supports multiple properties on custom URL paths (e.g. /mypath). After the page-based privacy request flow was introduced, navigating from a property path home page to the privacy request form, verification, and success pages caused the property path prefix to be dropped from the URL. This fix restores correct routing throughout the full privacy request flow when accessed from a custom property path.

Code Changes

  • Added usePathname() in HomePage to preserve the property path prefix when navigating to the privacy request form.
  • Updated PrivacyRequestFormPage, VerificationPage, and RequestSubmittedPage to use useParams() so all internal navigation stays within the current property path.
  • Added three new server-rendered pages under app/[propertyPath]/privacy-request/ (form, verify, success) that load the property-specific environment, mirroring the existing root-level privacy request routes.

Steps to Confirm

  1. Configure a property with a custom path (e.g. /mypath) and a privacy center config in the admin UI.
  2. Navigate to localhost:3001/mypath.
  3. Click an action card (e.g. Access or Erasure).
  4. Confirm the URL becomes localhost:3001/mypath/privacy-request/[actionKey] and the form reflects the property's configured options.
  5. Submit the form. If identity verification is enabled, confirm the URL transitions to .../verify and then .../success — all still under /mypath/....
  6. On the success page, click "Return home" and confirm it returns to localhost:3001/mypath.
  7. Repeat steps 2–6 from the root localhost:3001 to confirm the default (non-property-path) flow is unaffected.

Pre-Merge Checklist

  • Issue requirements met
  • All CI pipelines succeeded
  • CHANGELOG.md updated
    • Updates unreleased work already in Changelog, no new entry necessary
  • UX feedback:
    • No UX review needed
  • Followup issues:
    • No followup issues
  • Database migrations:
    • No migrations
  • Documentation:
    • No documentation updates required

@jpople jpople requested a review from a team as a code owner March 3, 2026 15:15
@jpople jpople requested review from lucanovera and removed request for a team March 3, 2026 15:15
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
fides-plus-nightly Ignored Ignored Preview Mar 3, 2026 4:12pm
fides-privacy-center Ignored Ignored Mar 3, 2026 4:12pm

Request Review

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 3, 2026

Greptile Summary

This PR fixes a routing regression where the property path prefix (e.g., /mypath) was dropped from the URL when navigating through the page-based privacy request flow (form → verify → success).

The fix is applied in two layers:

  • HomePage: Now uses usePathname() to preserve the prefix when constructing the initial navigation URL
  • Privacy request components (PrivacyRequestFormPage, VerificationPage, RequestSubmittedPage): Derive a basePath from useParams() so that all subsequent in-flow navigations include the prefix
  • Server-rendered pages: Three new page files are added under app/[propertyPath]/privacy-request/ to handle these routes and load the property-specific environment

All routing paths are handled correctly: both the root path (/) and property-path (/mypath) flows work properly, with the basePath || "/" fallback ensuring the root flow is unaffected. The implementation is consistent across all three new property-path pages and mirrors the existing root-level privacy request routes.

Confidence Score: 5/5

  • This PR is safe to merge. The routing fix is logically correct and does not affect the existing root-path flow.
  • The routing logic is end-to-end correct: both root path (/) and property-path (/mypath) flows are handled properly. All navigation paths through the property-path privacy request flow correctly carry the basePath prefix. The three new server-rendered pages properly mirror their root-level counterparts. The basePath || "/" fallback ensures the root flow remains unaffected.
  • No files require special attention.

Last reviewed commit: 37ea34b

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

8 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@greptile-apps greptile-apps bot mentioned this pull request Mar 3, 2026
18 tasks
// Preserve search params and property path prefix when navigating
const currentSearchParams = searchParams?.toString();
const encoded = encodePolicyKey(policyKey);
const prefix = pathname === "/" ? "" : pathname;
Copy link
Copy Markdown
Contributor

@lucanovera lucanovera Mar 3, 2026

Choose a reason for hiding this comment

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

@jpople This check looks a bit fragile. Is there a way we can check for the propertyPath param like you do in other components instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good suggestion, fixed.

Copy link
Copy Markdown
Contributor

@lucanovera lucanovera left a comment

Choose a reason for hiding this comment

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

Nice work. The privacy center path works great with the new page navigation. Code changes look good. Approved!

@jpople jpople added this pull request to the merge queue Mar 3, 2026
Merged via the queue into main with commit 11d78c9 Mar 3, 2026
41 of 42 checks passed
@jpople jpople deleted the jpople/eng-2869/privacy-center-routing branch March 3, 2026 16:35
jpople added a commit that referenced this pull request Mar 3, 2026
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