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

@axe-core/react: fallback on _reactInternals #437

Closed
wants to merge 1 commit into from

Conversation

seanparmelee
Copy link
Contributor

I was troubleshooting an issue where subsequent renders were not being checked for issues. Turns out the issue is due to the _reactInternalFiber field being renamed to _reactInternals in v17: facebook/react#18377.

image

This PR adds a fallback for _reactInternals. You can see this issue in action if you bump the shadow-dom example to React 17, run it, and then click on one of the services. You will not see the additional log statement in the console after clicking the service. I expect this to also fix #415.

Let me know if/how you'd like tests for this change. I'm guessing you'd probably prefer the shadow-dom example to remain at React 16, but maybe we could add another integration test that uses the NextJS example, which is already using React 17?

@CLAassistant
Copy link

CLAassistant commented Feb 1, 2022

CLA assistant check
All committers have signed the CLA.

const message: string = ((axeCore as unknown) as AxeWithAudit)._audit.data.failureSummaries[
key
].failureMessage(node[key].map(check => check.message || ''));
const message: string = (
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for this noise; these changes are from the formatter

@@ -286,6 +289,8 @@ function addComponent(component: any): void {
const reactInstanceDebugID = reactInstance._debugID;
const reactFiberInstance = component._reactInternalFiber || {};
const reactFiberInstanceDebugID = reactFiberInstance._debugID;
const reactInternals = component._reactInternals || {};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the rest of this code is the fix

@Zidious Zidious self-requested a review February 7, 2022 02:13
@Zidious
Copy link
Contributor

Zidious commented Feb 7, 2022

Hey @seanparmelee,

Apologies for the delay, we will review this today.

@straker
Copy link
Contributor

straker commented Feb 10, 2022

An update on this. We've been able to confirm this fixes the problem, but are trying to figure out the best way to add a test so we can catch something like this in the future.

@Zidious
Copy link
Contributor

Zidious commented Feb 10, 2022

Hey @seanparmelee,

We will need to update our entire test suite, so no test required at the moment. We have confirmed your fix works as intended.

Thank you for contributing

@pierceray
Copy link

The security review check has been running for days, what is the normal timeline for that succeeding?

@Zidious
Copy link
Contributor

Zidious commented Feb 11, 2022

We have had to cherry-pick this PR to get CI running. Will be merged shortly.

Reference: #437

@seanparmelee
Copy link
Contributor Author

Thanks @Zidious, so it sounds like we can close this one out then?

@seanparmelee
Copy link
Contributor Author

Also, while I was investigating all of this, I noticed that the _debugID field has since been removed in React (guessing that's slated for React 18) and logged #438 to bring this to your attention.

@seanparmelee
Copy link
Contributor Author

Resolved in #455

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

react: not triggering logs for navigation changes of react-router v5
5 participants