Fix undefined trackGaEvent and give row download buttons a busy state - #76
Draft
posthog[bot] wants to merge 1 commit into
Draft
Fix undefined trackGaEvent and give row download buttons a busy state#76posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
The LayerHub banner CTA called trackGaEvent, which is not defined anywhere in the project, so every click threw a ReferenceError and the banner_explore event was never recorded. Route it through trackUsageEvent like every other event in app.js, which already swallows provider failures. Row download buttons (JSON, BambuStudio JSON, .bbsflmt) fetch and sometimes zip before the browser saves a file, with no feedback for the whole wait and no guard against a repeat click. The bulk Download Selected / Download Bundle buttons already disable themselves and show a loading label; the per-row ones now get the equivalent through an is-busy class, aria-busy, and a spinner that works in both themes and respects prefers-reduced-motion. Generated-By: PostHog Desktop Task-Id: bab76398-4c5b-411a-812f-ebc00953b582
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
The homepage recorded a large volume of
$dead_clickand$rageclickevents on preset and download controls, flagged by a PostHog inbox report. Investigating turned up one real code defect named in the report, plus a genuine feedback gap on the download buttons.What the data showed
Checking what happens immediately after each dead click:
filter_changed, and dead clicks onDownload Bundle (.bbsflmt)/Download Selected/Continue Downloadare followed by the matchingdownload_*event.$dead_click_absolute_timeoutwith no mutation delay recorded.So the report's framing (controls that do not respond on the first click) does not hold as stated. Two things are still worth fixing.
Changes
1.
trackGaEventis not defined (app.js). The LayerHub banner CTA handler calledtrackGaEvent('banner_explore', ...), but no such function exists anywhere in the project — every click on the CTA threw aReferenceError. Confirmed against the project:banner_explorehas never been recorded, whilefilter_changed,download_singleanddownload_bundleall flow normally. The banner's only measurement has been silently dead since it shipped, and the throw also bypassed the deliberate "blocked analytics must never break downloads" safety net thattrackUsageEventprovides.Fixed by routing it through
trackUsageEvent, like every other event in the file.2. Row download buttons have no busy state.
JSON, BambuStudioJSON, and.bbsflmtall fetch (and sometimes zip) before the browser saves anything, with no visual feedback during the wait and no guard against a repeat click — each extra click starts another fetch and another zip. The bulkDownload Selected/Download Bundlebuttons already disable themselves and swap in a loading label; the per-row ones now get the equivalent via anis-busyclass,aria-busy, and acurrentColorspinner that works in both dark and wiki themes and respectsprefers-reduced-motion. This closes the real feedback gap on the highest-volume download path, and as a side effect makes the click mutate the DOM, which should also clear the false-positive dead clicks.The
.bbsflmtpath clears busy as soon as it hands off todownloadAsBbsflmt, whose own modals are the visible feedback from there — so the state cannot get stuck behind a modal.Follow-up measurement
Saved as Preset download friction — dead clicks & rage clicks vs downloads so the effect can be checked after this ships.
Testing
npm test— 139 pass. The one failure,scripts/generate-seo.test.mjs, is pre-existing onmain(missingposthog-nodeinstall in the sandbox) and unrelated.Added
tests/row-download-busy.test.js, and updatedtests/banner-subscribe.test.js, which had been asserting the brokentrackGaEventcall — it now asserts the string appears nowhere inapp.js.Created with PostHog Desktop from an inbox report