|
7 | 7 | * @flow
|
8 | 8 | */
|
9 | 9 |
|
10 |
| -import type {ReactNodeList} from 'shared/ReactTypes'; |
| 10 | +import type {ReactNodeList, ReactCustomFormAction} from 'shared/ReactTypes'; |
11 | 11 |
|
12 | 12 | import {
|
13 | 13 | checkHtmlStringCoercion,
|
@@ -668,15 +668,6 @@ function pushStringAttribute(
|
668 | 668 | }
|
669 | 669 | }
|
670 | 670 |
|
671 |
| -type CustomFormAction = { |
672 |
| - name?: string, |
673 |
| - action?: string, |
674 |
| - encType?: string, |
675 |
| - method?: string, |
676 |
| - target?: string, |
677 |
| - data?: FormData, |
678 |
| -}; |
679 |
| - |
680 | 671 | function makeFormFieldPrefix(responseState: ResponseState): string {
|
681 | 672 | // I'm just reusing this counter. It's not really the same namespace as "name".
|
682 | 673 | // It could just be its own counter.
|
@@ -761,7 +752,7 @@ function pushFormActionAttribute(
|
761 | 752 | );
|
762 | 753 | }
|
763 | 754 | }
|
764 |
| - const customAction: CustomFormAction = formAction.$$FORM_ACTION; |
| 755 | + const customAction: ReactCustomFormAction = formAction.$$FORM_ACTION; |
765 | 756 | if (typeof customAction === 'function') {
|
766 | 757 | // This action has a custom progressive enhancement form that can submit the form
|
767 | 758 | // back to the server if it's invoked before hydration. Such as a Server Action.
|
@@ -794,19 +785,19 @@ function pushFormActionAttribute(
|
794 | 785 | injectFormReplayingRuntime(responseState);
|
795 | 786 | }
|
796 | 787 | }
|
797 |
| - if (name !== null) { |
| 788 | + if (name != null) { |
798 | 789 | pushAttribute(target, 'name', name);
|
799 | 790 | }
|
800 |
| - if (formAction !== null) { |
| 791 | + if (formAction != null) { |
801 | 792 | pushAttribute(target, 'formAction', formAction);
|
802 | 793 | }
|
803 |
| - if (formEncType !== null) { |
| 794 | + if (formEncType != null) { |
804 | 795 | pushAttribute(target, 'formEncType', formEncType);
|
805 | 796 | }
|
806 |
| - if (formMethod !== null) { |
| 797 | + if (formMethod != null) { |
807 | 798 | pushAttribute(target, 'formMethod', formMethod);
|
808 | 799 | }
|
809 |
| - if (formTarget !== null) { |
| 800 | + if (formTarget != null) { |
810 | 801 | pushAttribute(target, 'formTarget', formTarget);
|
811 | 802 | }
|
812 | 803 | return formData;
|
@@ -1455,7 +1446,7 @@ function pushStartForm(
|
1455 | 1446 | );
|
1456 | 1447 | }
|
1457 | 1448 | }
|
1458 |
| - const customAction: CustomFormAction = formAction.$$FORM_ACTION; |
| 1449 | + const customAction: ReactCustomFormAction = formAction.$$FORM_ACTION; |
1459 | 1450 | if (typeof customAction === 'function') {
|
1460 | 1451 | // This action has a custom progressive enhancement form that can submit the form
|
1461 | 1452 | // back to the server if it's invoked before hydration. Such as a Server Action.
|
@@ -1487,16 +1478,16 @@ function pushStartForm(
|
1487 | 1478 | injectFormReplayingRuntime(responseState);
|
1488 | 1479 | }
|
1489 | 1480 | }
|
1490 |
| - if (formAction !== null) { |
| 1481 | + if (formAction != null) { |
1491 | 1482 | pushAttribute(target, 'action', formAction);
|
1492 | 1483 | }
|
1493 |
| - if (formEncType !== null) { |
| 1484 | + if (formEncType != null) { |
1494 | 1485 | pushAttribute(target, 'encType', formEncType);
|
1495 | 1486 | }
|
1496 |
| - if (formMethod !== null) { |
| 1487 | + if (formMethod != null) { |
1497 | 1488 | pushAttribute(target, 'method', formMethod);
|
1498 | 1489 | }
|
1499 |
| - if (formTarget !== null) { |
| 1490 | + if (formTarget != null) { |
1500 | 1491 | pushAttribute(target, 'target', formTarget);
|
1501 | 1492 | }
|
1502 | 1493 |
|
|
0 commit comments