Repository navigation
fix: give each range button on the Analytics page its own action id - #40
Merged
Merged
Conversation
The admin keys the elements of an actions block by their action id. The 7, 30 and 90 day buttons shared analytics:range, so React saw three children with one key and said so in the console. Each button now sends analytics:range|<days>; the range still travels in the value, and the plain id keeps working for the setup check's way back and for a page rendered before the update.
🦋 Changeset detectedLatest commit: 844aa32 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
The 7, 30 and 90 day buttons on the Analytics page shared the action id
analytics:range. The admin renders the elements of anactionsblock with their action id as the React key, and has since EmDash 1.0.1, so the three buttons were three children with one key. In development React logs "Encountered two children with the same key,analytics:range" on every load of the page.What changes
analytics:range|<days>. The range still travels in the button's value, so the handler reads it as before.analytics:rangekeeps working: the setup check's "Back to analytics" button sends it, and so does a page that was rendered before the update.analytics:content:view|…).Checks
tests/page.test.ts: everyactionsblock of the page has distinct action ids. It fails without the fix (expected 3 to be 5).tests/page-sync.test.tsnow switches to 90 days through the new id, in the real sandbox;tests/plugin.test.tskeeps using the plain one.pnpm typecheck,pnpm test(validate + 315 tests),pnpm build.create-emdash@1.6.0site with demo data, on desktop and on a phone with touch. 90, 7 and 30 days each load their range, the way back from the setup check lands on 30 days, and the console stays empty. Before the fix the same site logged the warning.Independent of #38 and #39: it merges with either branch without a conflict.