Mark useResponsiveValue as deprecated#7760
Conversation
Agent-Logs-Url: https://github.com/primer/react/sessions/b0c0f40d-21cd-449f-8c67-2bd64b08b8b3 Co-authored-by: siddharthkp <1863771+siddharthkp@users.noreply.github.com>
Agent-Logs-Url: https://github.com/primer/react/sessions/6f8c4762-fc70-4d71-ba62-cdade4e3de3a Co-authored-by: siddharthkp <1863771+siddharthkp@users.noreply.github.com>
🦋 Changeset detectedLatest commit: d82618b 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 |
|
There was a problem hiding this comment.
Pull request overview
Marks the useResponsiveValue hook as deprecated in Primer React documentation and metadata tooling, aligning with ADR-018 guidance to avoid SSR hydration layout shifts.
Changes:
- Add a JSDoc
@deprecatedannotation touseResponsiveValuewith guidance to usegetResponsiveAttributes+ CSS media queries. - Introduce
"status": "deprecated"for hooks in*.hookDocs.json, including schema/tooling support. - Add/extend contributor guidance for deprecations (new skill doc + update existing deprecation docs) and include a minor changeset.
Show a summary per file
| File | Description |
|---|---|
| packages/react/src/hooks/useResponsiveValue.ts | Adds @deprecated JSDoc annotation to the hook. |
| packages/react/src/hooks/useResponsiveValue.hookDocs.json | Marks hook docs metadata as deprecated via "status": "deprecated". |
| packages/react/script/hooks-json/hook.schema.json | Adds status field to the hook docs JSON schema. |
| packages/react/script/hooks-json/build.ts | Updates the local Hook type to include optional deprecated status. |
| contributor-docs/deprecating-components.md | Documents representing deprecated status in docs metadata for components/hooks. |
| .github/skills/deprecations/SKILL.md | Adds a reusable deprecations checklist/guide. |
| .changeset/cold-lions-listen.md | Adds a minor changeset announcing the deprecation. |
Copilot's findings
- Files reviewed: 7/7 changed files
- Comments generated: 0
| - [ ] Adding a `@deprecated` annotation in the component's source code. | ||
| - [ ] Adding a `Deprecation` section to the documentation of the component with the link of the recommended component and provide a diff. See [deprecated ActionList docs](https://primer.style/react/deprecated/ActionList#deprecation) as an example. | ||
| - [ ] Marking the component or hook docs metadata as deprecated with `"status": "deprecated"` in the relevant `*.docs.json` or `*.hookDocs.json` file. | ||
| - [ ] If the component has a docs page, adding a `Deprecation` section to the documentation with the link of the recommended component and provide a diff. See [deprecated ActionList docs](https://primer.style/react/deprecated/ActionList#deprecation) as an example. |
There was a problem hiding this comment.
this link does not exist?
There was a problem hiding this comment.
My bad, that link was already there. Replaced with a link for a recent deprecated component
| "status": { | ||
| "type": "string", | ||
| "enum": ["deprecated"], | ||
| "description": "The status of the hook." | ||
| }, |
There was a problem hiding this comment.
only valid value is deprecated? 🤔
There was a problem hiding this comment.
Yes... because there was no status field so far.
Made it ["ready", "deprecated"] so it doesn't look weird
|
👋 Hi from github/github-ui! Your integration PR is ready: https://github.com/github/github-ui/pull/18723 |
adr-018-responsive-values.md discourages the use of
useResponsiveValuehook because it relies on matchMedia and needs to wait until client hydration to choose the right value.But, we still export this hook without any warnings. This came up in a conversation on slack.
Marking the hook as deprecated in the docs because we want people to use css media queries instead.
Bonus:
.github/skills/deprecations/SKILL.mdguide for deprecating components and hooks.contributor-docs/deprecating-components.mdto document how deprecated status should be represented in component and hook docs metadata.Rollout strategy
Merge checklist