Fix empty query param when calling external dependency toolbar.js #1456
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.
Changes
Changed the URL to use
t=<num>
as query param instead of empty/undefined param name (v=161.1&=<num>
).Checklist
Backstory
We use posthog in a nextjs application and use nextjs's rewrites as a proxy for better tracking. We noticed that the toolbar does not work on our site. when checking the logs we noticed that the rewrites did not work for the toolbar:
But the
web-vitals.js
loaded without a problem...Further investigation lead to the empty query param for the
toolbar.js
rotating token to bust the cdn cache.?v=1.166.1?&=1728316200000
The current stable version of next.js (
14.2.14
) has a "bug" that can't handle empty query params correctly in rewrites. The most recent canary version of nextjs seems to not have this bug anymore.But still I think its better when posthog does not use an empty query param as this seems like something that was not intentional in the first place and secondly can result in unexpected behavior in frameworks like nextjs