Skip to content

Fix inconsistent staging URL logic in SimpleChart - #9015

Open
chosak wants to merge 1 commit into
mainfrom
fix/simple-chart-staging
Open

Fix inconsistent staging URL logic in SimpleChart#9015
chosak wants to merge 1 commit into
mainfrom
fix/simple-chart-staging

Conversation

@chosak

@chosak chosak commented Feb 26, 2026

Copy link
Copy Markdown
Member

SimpleChart has some logic that leverages wagtail-sharing logic to dynamically alter chart source data when unpublished drafts are being previewed.

If a page is being served by w-s, chart data source URLs that contain "production" get altered to instead pull from "staging".

An example page where this behavior can be observed is https://www.consumerfinance.gov/enforcement/payments-harmed-consumers/civil-penalty-fund/. If one views this page on our w-s domain, one observes that the download link under the chart points to "production". Looking in the browser console, however, shows that the data gets pulled from "staging".

Hackiness of this approach aside, one might wonder why the data source is altered, but the download link is not. If the idea is to use this w-s logic to allow for preview of staged data, perhaps the download link should be updated along with the data source.

Ping @wpears who last updated this code in #7115.

SimpleChart has some logic that leverages wagtail-sharing [0] logic to
dynamically alter chart source data when unpublished drafts are being
previewed.

If a page is being served by w-s, chart data source URLs that contain
"production" get altered to instead pull from "staging".

An example page where this behavior can be observed is
https://www.consumerfinance.gov/enforcement/payments-harmed-consumers/civil-penalty-fund/.
If one views this page on our w-s domain, one observes that the
download link under the chart points to "production". Looking in the
browser console, however, shows that the data gets pulled from
"staging".

Hackiness of this approach aside, one might wonder why the data source
is altered, but the download link is not. If the idea is to use this
w-s logic to allow for preview of staged data, perhaps the download link
should be updated along with the data source.

[0] https://github.com/cfpb/wagtail-sharing
@chosak
chosak requested review from willbarton and wpears February 26, 2026 16:34

@wpears wpears left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

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