[Fizz] Two More Fixes (#21288)
* Emit value of option tags * Mask the legacy context passed to classes
Sebastian Markbåge committed
Apr 15, 2021 at 13:26 UTC
9eddfbf5af13d95c703c10072c8c2f7c0ddf8071
2 files changed
+8
-7
packages/react-dom/src/server/ReactDOMServerFormatConfig.js
+4
-3
@@ -729,15 +729,16 @@ function pushStartOption(
729
}
730
}
731
break;
732
- case 'value':
733
- value = propValue;
734
- break;
732
case 'dangerouslySetInnerHTML':
733
invariant(
734
false,
735
'`dangerouslySetInnerHTML` does not work on <option>.',
736
);
737
// eslint-disable-next-line-no-fallthrough
738
+ case 'value':
739
+ value = propValue;
740
+ // We intentionally fallthrough to also set the attribute on the node.
741
+ // eslint-disable-next-line-no-fallthrough
742
default:
743
pushAttribute(target, responseState, propKey, propValue);
744
break;
packages/react-server/src/ReactFizzServer.js
+4
-4
@@ -563,11 +563,11 @@ function renderClassComponent(
563
Component: any,
564
props: any,
565
): void {
566
- const unmaskedContext = !disableLegacyContext
567
- ? task.legacyContext
566
+ const maskedContext = !disableLegacyContext
567
+ ? getMaskedContext(Component, task.legacyContext)
568
: undefined;
569
- const instance = constructClassInstance(Component, props, unmaskedContext);
570
- mountClassInstance(instance, Component, props, unmaskedContext);
569
+ const instance = constructClassInstance(Component, props, maskedContext);
570
+ mountClassInstance(instance, Component, props, maskedContext);
571
finishClassComponent(request, task, instance, Component, props);
572
}
573