Skip to content

FEAT: show the device id in the client-side example results - #226

Merged
justadreamer merged 3 commits into
mainfrom
feature/examples-js-device-id
Aug 6, 2026
Merged

FEAT: show the device id in the client-side example results#226
justadreamer merged 3 commits into
mainfrom
feature/examples-js-device-id

Conversation

@justadreamer

@justadreamer justadreamer commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

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 a Device Id: row to defaultDeviceFields, so every web example that uses the default field set shows it alongside the server-rendered one.

examples.min.js is not committed here, so this is a source-only change; the minified asset is produced by the existing build when the next examples-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:

  • server rendered 12280-128198-146368-18092 from the request headers, Sec-CH-UA client hints included
  • the client-side results resolved 15364-17017-146368-18092 once the hardware profile evidence arrived

Only 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 --check passes 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.

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.
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Documentation preview 👀

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.
@justadreamer
justadreamer merged commit 8916467 into main Aug 6, 2026
3 checks passed
@justadreamer
justadreamer deleted the feature/examples-js-device-id branch August 6, 2026 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant