feat(pci-instances): format default instance name value#22148
feat(pci-instances): format default instance name value#22148Tsiorifamonjena wants to merge 1 commit intofix/handle-instance-creation-multi-fixesfrom
Conversation
| const formMethods = useReactHookForm({ | ||
| resolver: zodResolver(instanceCreationSchema), | ||
| defaultValues: { | ||
| name: nameDefaultValue, |
There was a problem hiding this comment.
Why did you remove default value of name ?
What happen when the form loads for the first time ?
There was a problem hiding this comment.
It's because the default name will be handle on the Name component mounting now. The default value is build from flavor name. We cannot build it from there
When the form loads for the first time, if for any reason the api fail, fields will be empty and the button creation will be disabled
|
|
||
| useEffect(() => { | ||
| if (ovhInstanceName) setValue('name', ovhInstanceName); | ||
| }, [ovhInstanceName, setValue]); |
There was a problem hiding this comment.
When I change the name and select a new model, the name reset, I think it might be the cause
There was a problem hiding this comment.
Yes, the buisness rules predicted it. (TAPC-4541: When user select an another flavor, prefilled name is updated.) I can reconfirmed
There was a problem hiding this comment.
Ok, I thought it was a bug !
ff1de46 to
657a8fd
Compare
ref: #TAPC-4541 Signed-off-by: tsiorifamonjena <tsiorifamonjena.tianjanahary.ext@corp.ovh.com>
657a8fd to
8b487ad
Compare
| @@ -3,6 +3,8 @@ import { instanceNameRegex } from '@/constants'; | |||
| describe('Instance creation', () => { | |||
| test('Should accept only strings and special characters like "-", "_" and "." with a maximum length of 255', () => { | |||
There was a problem hiding this comment.
please update the special characters list in the test description too ;)
Description
Ticket Reference: #TAPC-4541
Additional Information