-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Append a referrer param to the "Built with Reflex" badge link #6951
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
Merged
masenf
merged 4 commits into
reflex-dev:main
from
FarhanAliRaza:farhan/eng-11714-badge-referrer-param
Aug 27, 2026
+62
−2
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
e20d354
ENG-11714 feat: append a referrer param to the "Built with Reflex" ba…
FarhanAliRaza fcd7267
ENG-11714 chore: bump reflex-base floor to 0.9.9.dev1 and mirror stic…
FarhanAliRaza dfad816
ENG-11714 fix: lower reflex-base dev floor to 0.9.8.dev1 so the works…
FarhanAliRaza d90374c
Update packages/reflex-components-core/pyproject.toml
masenf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Add the `REFLEX_REFERRER_PARAM` environment variable, read at compile time to append a `ref` query parameter to the "Built with Reflex" badge link. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/reflex-components-core/news/+badge-referrer-param.feature.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| The "Built with Reflex" badge appends a urlencoded `ref` query parameter to its reflex.dev link when the `REFLEX_REFERRER_PARAM` environment variable is set at compile time. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| """Tests for the "Built with Reflex" sticky badge.""" | ||
|
FarhanAliRaza marked this conversation as resolved.
|
||
|
|
||
| import pytest | ||
| from reflex_components_core.core.sticky import StickyBadge | ||
|
|
||
|
|
||
| def _badge_href() -> str: | ||
| """Render a fresh badge and extract its href prop. | ||
|
|
||
| Returns: | ||
| The rendered href value, without surrounding quotes. | ||
| """ | ||
| props = StickyBadge.create().render()["props"] | ||
| href_prop = next(p for p in props if p.startswith("href:")) | ||
| return href_prop.removeprefix("href:").strip('"') | ||
|
|
||
|
|
||
| def test_badge_href_default(monkeypatch: pytest.MonkeyPatch): | ||
| """Without a referrer param, the badge links to the plain reflex.dev URL.""" | ||
| monkeypatch.delenv("REFLEX_REFERRER_PARAM", raising=False) | ||
| assert _badge_href() == "https://reflex.dev" | ||
|
|
||
|
|
||
| def test_badge_href_with_referrer(monkeypatch: pytest.MonkeyPatch): | ||
| """A referrer param is appended as a ref query parameter.""" | ||
| monkeypatch.setenv("REFLEX_REFERRER_PARAM", "owner-123") | ||
| assert _badge_href() == "https://reflex.dev/?ref=owner-123" | ||
|
|
||
|
|
||
| def test_badge_href_urlencodes_referrer(monkeypatch: pytest.MonkeyPatch): | ||
| """Special characters in the referrer param are urlencoded.""" | ||
| monkeypatch.setenv("REFLEX_REFERRER_PARAM", "a b&c/d?e=f") | ||
| assert _badge_href() == "https://reflex.dev/?ref=a%20b%26c%2Fd%3Fe%3Df" | ||
|
|
||
|
|
||
| def test_badge_href_empty_referrer(monkeypatch: pytest.MonkeyPatch): | ||
| """An empty referrer param falls back to the default URL.""" | ||
| monkeypatch.setenv("REFLEX_REFERRER_PARAM", "") | ||
| assert _badge_href() == "https://reflex.dev" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.