FEAT: show the device id in the client-side example results - #226
Merged
Conversation
The client-side table exists to show what JavaScript evidence refines, but it omitted the one value that expresses the whole refinement. The device id is the hardware, platform and browser profile ids joined together, and the hardware and platform components are resolved client side, so it differs from the id the server rendered whenever the client corrects what the user agent claimed. Measured against the device-detection getting-started web example, with a browser presenting an iPhone user agent: the server renders 12280-128198-146368-18092 from the user agent alone, and the client-side results resolve 15364-17017-146368-18092 once the hardware profile evidence arrives. Showing both makes that difference visible in the examples rather than only in the raw flow data.
Contributor
The comment listed hardware, platform and browser. The id also carries a crawler component, which is the fourth of the four values.
Server-side detection works from the request headers as a whole, client hints included, not from the user agent on its own.
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 client-side results table in the shared examples helper exists to show what JavaScript evidence refines, but it omitted the one value that expresses the whole refinement. The device id is the hardware, platform, browser and crawler profile ids joined together, and the hardware and platform components are resolved client side, so it differs from the id rendered by the server whenever the client refines what the request headers claimed, the user agent and client hints alike.
What changed
pattern-library/source/js/examples.js: added aDevice Id:row todefaultDeviceFields, so every web example that uses the default field set shows it alongside the server-rendered one.examples.min.jsis not committed here, so this is a source-only change; the minified asset is produced by the existing build when the nextexamples-assets-v*release is cut.How it was tested
Loaded the device-detection getting-started web example in a real browser presenting an iPhone user agent, then loaded the modified helper over the shipped one and re-bound the callback:
12280-128198-146368-18092from the request headers,Sec-CH-UAclient hints included15364-17017-146368-18092once the hardware profile evidence arrivedOnly the hardware and platform components move; the browser and crawler components are unchanged. The new row renders with the refined value and the two differ, which is the behaviour the change is for.
node --checkpasses on the modified file.Consumers of the default field set pick this up when the release is cut and the example asset update runs; nothing changes for callers that pass their own
options.fields.