PolicyEngine / PolicyEngine/policyengine-app-v2
fix: Report sharing URLs use production prefix in preview environments
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 1
- Forks
- 3
- Avg merge
- 1d 50m
- Merged PRs (30d)
- 39
Description
Parent issue: #579
Summary
When sharing reports from Vercel preview deployments, the generated shareable URLs use the production domain prefix (app.policyengine.org) instead of the preview deployment URL.
Current Behavior
In a preview environment (e.g., policyengine-calculator-abc123.vercel.app):
- User creates/views a report
- User clicks "Share" or copies the report URL
- Generated URL:
https://app.policyengine.org/us/report-output/12345
Why This Matters
- Database is shared: Preview and production use the same API/database, so the report ID exists and loads
- Missing features: Production doesn't have features under development that exist in the preview
- Testing broken: Teammates testing a preview can't share links that point to the preview environment
- Confusing UX: Developers think they're testing new features but shared links go to old production code
Expected Behavior
In a preview environment:
- Generated URL:
https://policyengine-calculator-abc123.vercel.app/us/report-output/12345
Technical Notes
BASE_URLinconstants.tsis hardcoded tohttps://api.policyengine.org(API endpoint - correct)- Need separate handling for app URLs used in shareable links
- Should detect if running in Vercel preview and use
VERCEL_URLenvironment variable - Related to #565 which handles cross-app navigation URLs
Acceptance Criteria
- Report share URLs in preview environments point to preview deployment
- Production behavior unchanged
- Local development uses localhost URLs
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with constants.ts and trace the code that builds report share URLs, checking how the app distinguishes production, Vercel preview, and local environments. Review the Vercel environment variables, especially VERCEL_URL, and verify that preview links use the deployment URL, production remains unchanged, and local links use localhost.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100