Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[joy-ui] Fix issues reported by the React Compiler #42671

Merged
merged 4 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/mui-joy/src/Checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ const Checkbox = React.forwardRef(function Checkbox(inProps, ref) {

if (process.env.NODE_ENV !== 'production') {
const registerEffect = formControl?.registerEffect;
// TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler -- process.env never changes
// eslint-disable-next-line react-hooks/rules-of-hooks
React.useEffect(() => {
if (registerEffect) {
Expand Down
1 change: 1 addition & 0 deletions packages/mui-joy/src/FormControl/FormControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ const FormControl = React.forwardRef(function FormControl(inProps, ref) {

let registerEffect: undefined | (() => () => void);
if (process.env.NODE_ENV !== 'production') {
// TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler -- process.env never changes
// eslint-disable-next-line react-hooks/rules-of-hooks
const registeredInput = React.useRef(false);
anuujj marked this conversation as resolved.
Show resolved Hide resolved
registerEffect = () => {
Expand Down
1 change: 1 addition & 0 deletions packages/mui-joy/src/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ const Input = React.forwardRef(function Input(inProps, ref) {

if (process.env.NODE_ENV !== 'production') {
const registerEffect = formControl?.registerEffect;
// TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler -- process.env never changes
// eslint-disable-next-line react-hooks/rules-of-hooks
React.useEffect(() => {
if (registerEffect) {
Expand Down
1 change: 1 addition & 0 deletions packages/mui-joy/src/Radio/Radio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ const Radio = React.forwardRef(function Radio(inProps, ref) {

if (process.env.NODE_ENV !== 'production') {
const registerEffect = formControl?.registerEffect;
// TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler -- process.env never changes
// eslint-disable-next-line react-hooks/rules-of-hooks
React.useEffect(() => {
if (registerEffect) {
Expand Down
1 change: 1 addition & 0 deletions packages/mui-joy/src/RadioGroup/RadioGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ const RadioGroup = React.forwardRef(function RadioGroup(inProps, ref) {

if (process.env.NODE_ENV !== 'production') {
const registerEffect = formControl?.registerEffect;
// TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler -- process.env never changes
// eslint-disable-next-line react-hooks/rules-of-hooks
React.useEffect(() => {
if (registerEffect) {
Expand Down
1 change: 1 addition & 0 deletions packages/mui-joy/src/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ const Select = React.forwardRef(function Select<OptionValue extends {}, Multiple

if (process.env.NODE_ENV !== 'production') {
const registerEffect = formControl?.registerEffect;
// TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler -- process.env never changes
// eslint-disable-next-line react-hooks/rules-of-hooks
React.useEffect(() => {
if (registerEffect) {
Expand Down
1 change: 1 addition & 0 deletions packages/mui-joy/src/Switch/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ const Switch = React.forwardRef(function Switch(inProps, ref) {

if (process.env.NODE_ENV !== 'production') {
const registerEffect = formControl?.registerEffect;
// TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler -- process.env never changes
// eslint-disable-next-line react-hooks/rules-of-hooks
React.useEffect(() => {
if (registerEffect) {
Expand Down
1 change: 1 addition & 0 deletions packages/mui-joy/src/Textarea/Textarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ const Textarea = React.forwardRef(function Textarea(inProps, ref) {

if (process.env.NODE_ENV !== 'production') {
const registerEffect = formControl?.registerEffect;
// TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler -- process.env never changes
// eslint-disable-next-line react-hooks/rules-of-hooks
React.useEffect(() => {
if (registerEffect) {
Expand Down
1 change: 1 addition & 0 deletions packages/mui-joy/src/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ const Tooltip = React.forwardRef(function Tooltip(inProps, ref) {
const prevUserSelect: React.MutableRefObject<string | undefined> = React.useRef();
const stopTouchInteraction = useEventCallback(() => {
if (prevUserSelect.current !== undefined) {
// TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler -- WebkitUserSelect is required outside the component
(document.body.style as unknown as { WebkitUserSelect?: string }).WebkitUserSelect =
prevUserSelect.current;
prevUserSelect.current = undefined;
Expand Down
1 change: 1 addition & 0 deletions packages/mui-joy/src/styles/ThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const useTheme = (): Theme => {
const theme = useSystemTheme(defaultTheme);

if (process.env.NODE_ENV !== 'production') {
// TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler -- process.env never changes
// eslint-disable-next-line react-hooks/rules-of-hooks
React.useDebugValue(theme);
}
Expand Down
1 change: 1 addition & 0 deletions packages/mui-joy/src/styles/extendTheme.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ describe('extendTheme', () => {

function Test() {
const theme = useTheme();
aarongarciah marked this conversation as resolved.
Show resolved Hide resolved
// TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler -- styles is required outside the component
styles = theme.unstable_sx({ bgcolor: 'primary.500' });
return null;
}
Expand Down
Loading