PLASMA-7458: fix ref forwarding for {Date/Time}-Picker - #2986
PLASMA-7458: fix ref forwarding for {Date/Time}-Picker#2986TitanKuzmich wants to merge 2 commits into
Conversation
📝 WalkthroughWalkthroughDatePicker and TimePicker now forward refs to their internal input elements. React Hook Form documentation across product sites adds Controller-based DatePicker examples with validation, error display, and focus handling. ChangesInput ref integration
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install timed out. The project may have too many dependencies for the sandbox. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Theme Builder app deployed! https://plasma.sberdevices.ru/pr/plasma-theme-builder-pr-2986/ |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
website/plasma-b2c-docs/docs/form/ReactHookForm.mdx (1)
337-413: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd
defaultValues/defaultValueto the new Controller example to avoid RHF's dev warning.All six new "tsx live" examples call
useForm()with nodefaultValues, and neitherControllerspecifies its owndefaultValue. React Hook Form logs a "Controller is missing defaultValue prop" console warning in this situation, which will show up for visitors trying the live playground on every one of these docs pages.
website/plasma-b2c-docs/docs/form/ReactHookForm.mdx#L337-L413: passuseForm({ defaultValues: { birthDate: "", issueDate: "" } })(or adddefaultValue=""to eachController).website/sdds-netology-docs/docs/form/ReactHookForm.mdx#L337-L413: same fix.website/sdds-platform-ai-docs/docs/form/ReactHookForm.mdx#L278-L360: same fix.website/sdds-sbcom-docs/docs/form/ReactHookForm.mdx#L337-L413: same fix.website/sdds-scan-docs/docs/form/ReactHookForm.mdx#L337-L413: same fix.website/sdds-serv-docs/docs/form/ReactHookForm.mdx#L337-L412: same fix.♻️ Proposed fix (apply per file)
const { control, handleSubmit, setFocus, formState: { errors }, - } = useForm(); + } = useForm({ defaultValues: { birthDate: "", issueDate: "" } });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@website/plasma-b2c-docs/docs/form/ReactHookForm.mdx` around lines 337 - 413, All six ReactHookForm live examples omit initial values, causing Controller warnings. Update useForm in the examples at website/plasma-b2c-docs/docs/form/ReactHookForm.mdx:337-413, website/sdds-netology-docs/docs/form/ReactHookForm.mdx:337-413, website/sdds-platform-ai-docs/docs/form/ReactHookForm.mdx:278-360, website/sdds-sbcom-docs/docs/form/ReactHookForm.mdx:337-413, website/sdds-scan-docs/docs/form/ReactHookForm.mdx:337-413, and website/sdds-serv-docs/docs/form/ReactHookForm.mdx:337-412 to provide empty initial values for birthDate and issueDate, or set defaultValue on each corresponding Controller.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/plasma-new-hope/src/components/TimePicker/TimePicker.tsx`:
- Line 34: Add a changeset or CHANGELOG migration note for the TimePicker ref
type change introduced by forwardRef<HTMLInputElement, TimePickerProps>.
Document that refs now target the underlying input rather than the wrapper div,
and update any related documentation that describes the ref as an
HTMLDivElement.
---
Nitpick comments:
In `@website/plasma-b2c-docs/docs/form/ReactHookForm.mdx`:
- Around line 337-413: All six ReactHookForm live examples omit initial values,
causing Controller warnings. Update useForm in the examples at
website/plasma-b2c-docs/docs/form/ReactHookForm.mdx:337-413,
website/sdds-netology-docs/docs/form/ReactHookForm.mdx:337-413,
website/sdds-platform-ai-docs/docs/form/ReactHookForm.mdx:278-360,
website/sdds-sbcom-docs/docs/form/ReactHookForm.mdx:337-413,
website/sdds-scan-docs/docs/form/ReactHookForm.mdx:337-413, and
website/sdds-serv-docs/docs/form/ReactHookForm.mdx:337-412 to provide empty
initial values for birthDate and issueDate, or set defaultValue on each
corresponding Controller.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: cd4ed7ef-2a7b-4efa-b110-249069ddfe13
📒 Files selected for processing (16)
packages/plasma-new-hope/src/components/DatePicker/SingleDate/SingleDate.tsxpackages/plasma-new-hope/src/components/TimePicker/TimePicker.tsxwebsite/plasma-b2c-docs/docs/form/ReactHookForm.mdxwebsite/plasma-giga-docs/docs/form/ReactHookForm.mdxwebsite/plasma-homeds-docs/docs/form/ReactHookForm.mdxwebsite/plasma-web-docs/docs/form/ReactHookForm.mdxwebsite/sdds-bizcom-docs/docs/form/ReactHookForm.mdxwebsite/sdds-cs-docs/docs/form/ReactHookForm.mdxwebsite/sdds-dfa-docs/docs/form/ReactHookForm.mdxwebsite/sdds-finai-docs/docs/form/ReactHookForm.mdxwebsite/sdds-insol-docs/docs/form/ReactHookForm.mdxwebsite/sdds-netology-docs/docs/form/ReactHookForm.mdxwebsite/sdds-platform-ai-docs/docs/form/ReactHookForm.mdxwebsite/sdds-sbcom-docs/docs/form/ReactHookForm.mdxwebsite/sdds-scan-docs/docs/form/ReactHookForm.mdxwebsite/sdds-serv-docs/docs/form/ReactHookForm.mdx
Core
DatePicker, TimePicker
refсRootнаinputWhat/why changed
refсRootнаinput📦 Published PR as canary version:
Canary Versions✨ Test out this PR locally via:
npm install @salutejs/plasma-asdk@0.385.0-canary.2986.30090294685.0 npm install @salutejs/plasma-b2c@1.627.0-canary.2986.30090294685.0 npm install @salutejs/plasma-core@1.234.0-canary.2986.30090294685.0 npm install @salutejs/plasma-giga@0.354.0-canary.2986.30090294685.0 npm install @salutejs/plasma-homeds@0.354.0-canary.2986.30090294685.0 npm install @salutejs/plasma-hope@1.381.0-canary.2986.30090294685.0 npm install @salutejs/plasma-icons@1.244.0-canary.2986.30090294685.0 npm install @salutejs/plasma-new-hope@0.371.0-canary.2986.30090294685.0 npm install @salutejs/plasma-tokens@1.146.0-canary.2986.30090294685.0 npm install @salutejs/plasma-tokens-b2b@1.60.0-canary.2986.30090294685.0 npm install @salutejs/plasma-tokens-b2c@0.71.0-canary.2986.30090294685.0 npm install @salutejs/plasma-tokens-web@1.75.0-canary.2986.30090294685.0 npm install @salutejs/plasma-typo@0.48.0-canary.2986.30090294685.0 npm install @salutejs/plasma-web@1.629.0-canary.2986.30090294685.0 npm install @salutejs/sdds-bizcom@0.359.0-canary.2986.30090294685.0 npm install @salutejs/sdds-cs@0.363.0-canary.2986.30090294685.0 npm install @salutejs/sdds-dfa@0.357.0-canary.2986.30090294685.0 npm install @salutejs/sdds-finai@0.350.0-canary.2986.30090294685.0 npm install @salutejs/sdds-insol@0.354.0-canary.2986.30090294685.0 npm install @salutejs/sdds-netology@0.358.0-canary.2986.30090294685.0 npm install @salutejs/sdds-os@0.29.0-canary.2986.30090294685.0 npm install @salutejs/sdds-platform-ai@0.358.0-canary.2986.30090294685.0 npm install @salutejs/sdds-sbcom@0.359.0-canary.2986.30090294685.0 npm install @salutejs/sdds-scan@0.357.0-canary.2986.30090294685.0 npm install @salutejs/sdds-serv@0.358.0-canary.2986.30090294685.0 npm install @salutejs/core-themes@0.36.0-canary.2986.30090294685.0 npm install @salutejs/plasma-themes@0.58.0-canary.2986.30090294685.0 npm install @salutejs/sdds-themes@0.72.0-canary.2986.30090294685.0 npm install @salutejs/sdds-api-tests@0.16.0-canary.2986.30090294685.0 npm install @salutejs/plasma-cy-utils@0.164.0-canary.2986.30090294685.0 npm install @salutejs/plasma-sb-utils@0.235.0-canary.2986.30090294685.0 npm install @salutejs/plasma-tokens-utils@0.56.0-canary.2986.30090294685.0 # or yarn add @salutejs/plasma-asdk@0.385.0-canary.2986.30090294685.0 yarn add @salutejs/plasma-b2c@1.627.0-canary.2986.30090294685.0 yarn add @salutejs/plasma-core@1.234.0-canary.2986.30090294685.0 yarn add @salutejs/plasma-giga@0.354.0-canary.2986.30090294685.0 yarn add @salutejs/plasma-homeds@0.354.0-canary.2986.30090294685.0 yarn add @salutejs/plasma-hope@1.381.0-canary.2986.30090294685.0 yarn add @salutejs/plasma-icons@1.244.0-canary.2986.30090294685.0 yarn add @salutejs/plasma-new-hope@0.371.0-canary.2986.30090294685.0 yarn add @salutejs/plasma-tokens@1.146.0-canary.2986.30090294685.0 yarn add @salutejs/plasma-tokens-b2b@1.60.0-canary.2986.30090294685.0 yarn add @salutejs/plasma-tokens-b2c@0.71.0-canary.2986.30090294685.0 yarn add @salutejs/plasma-tokens-web@1.75.0-canary.2986.30090294685.0 yarn add @salutejs/plasma-typo@0.48.0-canary.2986.30090294685.0 yarn add @salutejs/plasma-web@1.629.0-canary.2986.30090294685.0 yarn add @salutejs/sdds-bizcom@0.359.0-canary.2986.30090294685.0 yarn add @salutejs/sdds-cs@0.363.0-canary.2986.30090294685.0 yarn add @salutejs/sdds-dfa@0.357.0-canary.2986.30090294685.0 yarn add @salutejs/sdds-finai@0.350.0-canary.2986.30090294685.0 yarn add @salutejs/sdds-insol@0.354.0-canary.2986.30090294685.0 yarn add @salutejs/sdds-netology@0.358.0-canary.2986.30090294685.0 yarn add @salutejs/sdds-os@0.29.0-canary.2986.30090294685.0 yarn add @salutejs/sdds-platform-ai@0.358.0-canary.2986.30090294685.0 yarn add @salutejs/sdds-sbcom@0.359.0-canary.2986.30090294685.0 yarn add @salutejs/sdds-scan@0.357.0-canary.2986.30090294685.0 yarn add @salutejs/sdds-serv@0.358.0-canary.2986.30090294685.0 yarn add @salutejs/core-themes@0.36.0-canary.2986.30090294685.0 yarn add @salutejs/plasma-themes@0.58.0-canary.2986.30090294685.0 yarn add @salutejs/sdds-themes@0.72.0-canary.2986.30090294685.0 yarn add @salutejs/sdds-api-tests@0.16.0-canary.2986.30090294685.0 yarn add @salutejs/plasma-cy-utils@0.164.0-canary.2986.30090294685.0 yarn add @salutejs/plasma-sb-utils@0.235.0-canary.2986.30090294685.0 yarn add @salutejs/plasma-tokens-utils@0.56.0-canary.2986.30090294685.0Summary by CodeRabbit
Bug Fixes
Documentation
Controllerusage, validation feedback, and focus handling withsetFocus().