-
Notifications
You must be signed in to change notification settings - Fork 4.8k
ESLint: Bump eslint-plugin-react-compiler to latest beta
#69945
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,13 +6,7 @@ import clsx from 'clsx'; | |
| /** | ||
| * WordPress dependencies | ||
| */ | ||
| import { | ||
| useState, | ||
| useRef, | ||
| useEffect, | ||
| useCallback, | ||
| useMemo, | ||
| } from '@wordpress/element'; | ||
| import { useState, useRef, useCallback, useMemo } from '@wordpress/element'; | ||
| import { __, sprintf } from '@wordpress/i18n'; | ||
| import { lineSolid, moreVertical, plus } from '@wordpress/icons'; | ||
| import { useDebounce } from '@wordpress/compose'; | ||
|
|
@@ -296,12 +290,6 @@ function PaletteEditListView< T extends PaletteElement >( { | |
| popoverProps, | ||
| addColorRef, | ||
| }: PaletteEditListViewProps< T > ) { | ||
| // When unmounting the component if there are empty elements (the user did not complete the insertion) clean them. | ||
| const elementsReferenceRef = useRef< typeof elements >(); | ||
| useEffect( () => { | ||
| elementsReferenceRef.current = elements; | ||
| }, [ elements ] ); | ||
|
|
||
|
Comment on lines
-299
to
-304
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This ref was originally used as part of a conditional statement: https://github.com/WordPress/gutenberg/pull/36820/files#diff-3749f548d9b617ffd46aadb474aae082c8e26ce9bab26599e892f2fd9f2f1b35R160 However, since the conditional statement itself has been removed, this ref is no longer used anywhere. |
||
| const debounceOnChange = useDebounce( | ||
| ( updatedElements: T[] ) => | ||
| onChange( deduplicateElementSlugs( updatedElements ) ), | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| /** | ||
| * WordPress dependencies | ||
| */ | ||
| import { useMemo, useRef, useInsertionEffect } from '@wordpress/element'; | ||
| import { useMemo, useState, useInsertionEffect } from '@wordpress/element'; | ||
| import { useRefEffect } from '@wordpress/compose'; | ||
|
|
||
| /** | ||
|
|
@@ -26,13 +26,16 @@ const allEventListeners = [ | |
| ]; | ||
|
|
||
| export function useEventListeners( props ) { | ||
| const propsRef = useRef( props ); | ||
| const [ state, setState ] = useState( props ); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the warning here? This latest prop pattern should still be supported.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| useInsertionEffect( () => { | ||
| propsRef.current = props; | ||
| setState( props ); | ||
| } ); | ||
| const refEffects = useMemo( | ||
| () => allEventListeners.map( ( refEffect ) => refEffect( propsRef ) ), | ||
| [ propsRef ] | ||
| () => | ||
| allEventListeners.map( ( refEffect ) => | ||
| refEffect( { current: state } ) | ||
| ), | ||
| [ state ] | ||
| ); | ||
|
|
||
| return useRefEffect( | ||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ref was originally used as part of a conditional statement to prevent focus loss: d66d53b?diff=unified#diff-278587d24f4060dd3b05ef00adba5f9afdda8fe5b52a8587005b5012a9fc8df0R115
However, since the conditional statement itself has been removed, this ref is no longer used anywhere: https://github.com/WordPress/gutenberg/pull/32552/files#diff-278587d24f4060dd3b05ef00adba5f9afdda8fe5b52a8587005b5012a9fc8df0L158-L167