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

chore: <p> cannot appear as a descendant of <p>. #3417

Merged
merged 1 commit into from
Mar 12, 2024

Conversation

compojoom
Copy link
Collaborator

note to testers: I can't see this error in production, it seems to only appear with the local dev release, so you'll have to test this locally

fix: Warning: validateDOMNesting(...):

cannot appear as a descendant of

.

In some locations we had nested inside another this renders 2

tags inside of each-other and that is not valid. The other way around was having a that is nested inside of a Typograpühy which also seems to be not valid.

How to test it

run the website with 'yarn dev' -> open the wallet box on top -> you shouldn't see:
grafik

Screenshots

Checklist

  • I've tested the branch on mobile 📱
  • I've documented how it affects the analytics (if at all) 📊
  • I've written a unit/e2e test for it (if applicable) 🧑‍💻

Copy link

github-actions bot commented Mar 11, 2024

Copy link

github-actions bot commented Mar 11, 2024

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

Copy link

github-actions bot commented Mar 11, 2024

📦 Next.js Bundle Analysis for safe-wallet-web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 1015.86 KB (🟡 +6 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Copy link

github-actions bot commented Mar 11, 2024

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
79.38% (-0.02% 🔻)
11125/14015
🔴 Branches
58.38% (-0.02% 🔻)
2609/4469
🟡 Functions
66.03% (-0.04% 🔻)
1792/2714
🟢 Lines
80.63% (-0.03% 🔻)
10021/12428
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢
... / index.tsx
82.35% (-8.82% 🔻)
66.67% (-16.67% 🔻)
50% (-12.5% 🔻)
83.87% (-9.68% 🔻)
🟢
... / index.tsx
89.29% (-0.37% 🔻)
88.89% 50%
88.46% (-0.43% 🔻)

Test suite run success

1410 tests passing in 195 suites.

Report generated by 🧪jest coverage report action from 04fe8dc

Copy link
Member

@katspaugh katspaugh left a comment

Choose a reason for hiding this comment

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

This solution isn’t very good for semantics/a11y though, is it? I would rather we find the places where this warning is thrown and fix just them.

fix: Warning: validateDOMNesting(...): <p> cannot appear as a descendant of <p>.

In some locations we had <Typography variant=“body1”> nested inside another <Typography> this renders 2 <p> tags inside of each-other and that is not valid.
The other way around was having a <Box> that is nested inside of a Typography which also seems to be not valid.
@compojoom
Copy link
Collaborator Author

Ok, you've got a point. On the other hand this error is pretty easy to get into. the moment you render a component inside a Typography component you don't know what the nested component is going to use to render.
For example look at the stack trace:
grafik

We've rendered EthHashInfo inside of Typography. EthHashInfo uses divs. Now you have

<div<....

- which is invalid.

I've now fixed those issues by rendering typography with component="div". At least where I found those issues.

Copy link
Member

@katspaugh katspaugh left a comment

Choose a reason for hiding this comment

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

👍

@katspaugh katspaugh changed the title fix: <p> cannot appear as a descendant of <p>. chore: <p> cannot appear as a descendant of <p>. Mar 12, 2024
@katspaugh katspaugh merged commit a370b7d into dev Mar 12, 2024
14 checks passed
@katspaugh katspaugh deleted the fix-nested-descendant branch March 12, 2024 11:28
@github-actions github-actions bot locked and limited conversation to collaborators Mar 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants