Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Frontend can crash if query string is invalid #5236

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rolodato
Copy link
Member

Trying to load a URL with a malformed query string currently crashes the frontend. For example (note the extra = at the end):

https://app.flagsmith.com/project/16945/environment/ihAHot7taBsh6hbHJKdYHs/features?is_archived=false&tag_strategy=INTERSECTION&page=1&search=&sortBy=name&sortOrder=asc=

Fails with:

Uncaught SyntaxError: JSON.parse: expected ',' or '}' after property value in object at line 1 column 110 of the JSON data
    fromParam 

At least one customer ran into this when using the ClearURLs Firefox add-on: https://addons.mozilla.org/en/firefox/addon/clearurls/

It's probably better to use a dedicated hook for accessing the query string instead of parsing it on every fromParam call, but this is a stop-gap solution to at least stop the frontend crashing.

Tested by trying to load an equivalent URL locally.

@rolodato rolodato requested a review from a team as a code owner March 19, 2025 15:14
@rolodato rolodato requested review from kyle-ssg and removed request for a team March 19, 2025 15:14
Copy link

vercel bot commented Mar 19, 2025

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 Mar 19, 2025 3:14pm
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 19, 2025 3:14pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
docs ⬜️ Ignored (Inspect) Mar 19, 2025 3:14pm

@github-actions github-actions bot added front-end Issue related to the React Front End Dashboard fix labels Mar 19, 2025
Copy link
Contributor

github-actions bot commented Mar 19, 2025

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-api-test:pr-5236 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-e2e:pr-5236 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-5236 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-5236 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-5236 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-frontend:pr-5236 Finished ✅ Results

Copy link
Contributor

github-actions bot commented Mar 19, 2025

Uffizzi Ephemeral Environment deployment-62054

☁️ https://app.uffizzi.com/github.com/Flagsmith/flagsmith/pull/5236

📄 View Application Logs etc.

What is Uffizzi? Learn more!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix front-end Issue related to the React Front End Dashboard
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant