-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Fix React key and ref console errors in Report Debug Page #61776
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
Merged
tgolen
merged 5 commits into
Expensify:main
from
nabi-ebrahimi:fix/report-debug-console-errors
May 9, 2025
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6d1265d
fix: add key prop to list items in DebugReportPage and DebugDetails
nabi-ebrahimi 8dca4af
fix: wrap ConstantSelector and DateTimeSelector in forwardRef to supp…
nabi-ebrahimi a393873
Add `canBeMissing: true` to useOnyx call for DEBUG_DETAILS_FORM_DRAFT
nabi-ebrahimi 6c8da7e
Add canBeMissing: true to useOnyx call for ONYXKEYS.MODAL
nabi-ebrahimi 0734f43
Merge branch 'main' into fix/report-debug-console-errors
nabi-ebrahimi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import {useRoute} from '@react-navigation/native'; | ||
import React, {useEffect} from 'react'; | ||
import type {ForwardedRef} from 'react'; | ||
import React, {forwardRef, useEffect} from 'react'; | ||
import type {View} from 'react-native'; | ||
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription'; | ||
import Navigation from '@libs/Navigation/Navigation'; | ||
import CONST from '@src/CONST'; | ||
|
@@ -23,7 +25,12 @@ type DateTimeSelectorProps = { | |
inputID: string; | ||
}; | ||
|
||
function DateTimeSelector({errorText = '', name, value, onInputChange}: DateTimeSelectorProps) { | ||
function DateTimeSelector( | ||
{errorText = '', name, value, onInputChange}: DateTimeSelectorProps, | ||
// The ref is required by React.forwardRef to avoid warnings, even though it's not used yet. | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
ref: ForwardedRef<View>, | ||
Comment on lines
+28
to
+32
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. Same here. |
||
) { | ||
const fieldValue = (useRoute().params as Record<string, string> | undefined)?.[name]; | ||
|
||
useEffect(() => { | ||
|
@@ -58,4 +65,4 @@ function DateTimeSelector({errorText = '', name, value, onInputChange}: DateTime | |
|
||
DateTimeSelector.displayName = 'DateTimeSelector'; | ||
|
||
export default DateTimeSelector; | ||
export default forwardRef(DateTimeSelector); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We don't need to specify this param here. rever this line.
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.
Hi @parasharrajat, just to clarify—are you suggesting I remove the ref parameter itself, or just the comment associated with it?
As I mentioned in my proposal, removing the ref parameter introduces another warning. Could you please confirm your intention?
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.
Let me check that warning.
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.
Looks like we need it.