Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0b8fd7e

Browse files
chore: fix :first-child warning (#17727)
Fix the following warning:```The pseudo class ":first-child" is potentially unsafe when doing server-side rendering.```
1 parent902c34c commit0b8fd7e

File tree

9 files changed

+16
-21
lines changed

9 files changed

+16
-21
lines changed

‎site/src/components/InputGroup/InputGroup.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,9 @@ export const InputGroup: FC<HTMLProps<HTMLDivElement>> = (props) => {
2525
zIndex:2,
2626
},
2727

28-
"& > *:first-child":{
28+
"& > *:first-of-type":{
2929
borderTopRightRadius:0,
3030
borderBottomRightRadius:0,
31-
32-
"&.MuiFormControl-root .MuiInputBase-root":{
33-
borderTopRightRadius:0,
34-
borderBottomRightRadius:0,
35-
},
3631
},
3732

3833
"& > *:last-child":{
@@ -45,7 +40,7 @@ export const InputGroup: FC<HTMLProps<HTMLDivElement>> = (props) => {
4540
},
4641
},
4742

48-
"& > *:not(:first-child):not(:last-child)":{
43+
"& > *:not(:first-of-type):not(:last-child)":{
4944
borderRadius:0,
5045

5146
"&.MuiFormControl-root .MuiInputBase-root":{

‎site/src/components/Markdown/Markdown.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -348,19 +348,19 @@ const MarkdownGfmAlert: FC<MarkdownGfmAlertProps> = ({
348348
"[&_p]:m-0 [&_p]:mb-2",
349349

350350
alertType==="important"&&
351-
"border-highlight-purple [&_p:first-child]:text-highlight-purple",
351+
"border-highlight-purple [&_p:first-of-type]:text-highlight-purple",
352352

353353
alertType==="warning"&&
354-
"border-border-warning [&_p:first-child]:text-border-warning",
354+
"border-border-warning [&_p:first-of-type]:text-border-warning",
355355

356356
alertType==="note"&&
357-
"border-highlight-sky [&_p:first-child]:text-highlight-sky",
357+
"border-highlight-sky [&_p:first-of-type]:text-highlight-sky",
358358

359359
alertType==="tip"&&
360-
"border-highlight-green [&_p:first-child]:text-highlight-green",
360+
"border-highlight-green [&_p:first-of-type]:text-highlight-green",
361361

362362
alertType==="caution"&&
363-
"border-highlight-red [&_p:first-child]:text-highlight-red",
363+
"border-highlight-red [&_p:first-of-type]:text-highlight-red",
364364
)}
365365
>
366366
<pclassName="font-bold">

‎site/src/components/Table/Table.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ export const TableBody = React.forwardRef<
3636
<tbody
3737
ref={ref}
3838
className={cn(
39-
"[&>tr:first-child>td]:border-t [&>tr>td:first-child]:border-l",
39+
"[&>tr:first-of-type>td]:border-t [&>tr>td:first-of-type]:border-l",
4040
"[&>tr:last-child>td]:border-b [&>tr>td:last-child]:border-r",
41-
"[&>tr:first-child>td:first-child]:rounded-tl-md [&>tr:first-child>td:last-child]:rounded-tr-md",
42-
"[&>tr:last-child>td:first-child]:rounded-bl-md [&>tr:last-child>td:last-child]:rounded-br-md",
41+
"[&>tr:first-of-type>td:first-of-type]:rounded-tl-md [&>tr:first-of-type>td:last-child]:rounded-tr-md",
42+
"[&>tr:last-child>td:first-of-type]:rounded-bl-md [&>tr:last-child>td:last-child]:rounded-br-md",
4343
className,
4444
)}
4545
{...props}

‎site/src/modules/resources/ResourceCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const styles = {
1919
borderBottom:0,
2020
},
2121

22-
"&:first-child":{
22+
"&:first-of-type":{
2323
borderTopLeftRadius:8,
2424
borderTopRightRadius:8,
2525
},

‎site/src/modules/workspaces/WorkspaceTiming/Chart/Chart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ const styles = {
185185
},
186186
},
187187

188-
"& li:first-child":{
188+
"& li:first-of-type":{
189189
color:theme.palette.text.secondary,
190190
},
191191

‎site/src/modules/workspaces/WorkspaceTiming/Chart/XAxis.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const XAxisLabel: FC<HTMLProps<HTMLLIElement>> = (props) => {
5656
// Note: This adjustment is not applied to the first element,
5757
// as the 0 label/value is not displayed in the chart.
5858
width:"calc(var(--x-axis-width) * 2)",
59-
"&:not(:first-child)":{
59+
"&:not(:first-of-type)":{
6060
marginLeft:"calc(-1 * var(--x-axis-width))",
6161
},
6262
},

‎site/src/modules/workspaces/WorkspaceTiming/Chart/YAxis.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const styles = {
3535
flexShrink:0,
3636
},
3737
section:(theme)=>({
38-
"&:not(:first-child)":{
38+
"&:not(:first-of-type)":{
3939
borderTop:`1px solid${theme.palette.divider}`,
4040
},
4141
}),

‎site/src/pages/TemplatePage/TemplateInsightsPage/TemplateInsightsPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ const TemplateParametersUsagePanel: FC<TemplateParametersUsagePanelProps> = ({
559559
marginRight:-24,
560560
borderTop:`1px solid${theme.palette.divider}`,
561561
width:"calc(100% + 48px)",
562-
"&:first-child":{
562+
"&:first-of-type":{
563563
borderTop:0,
564564
},
565565
gap:24,

‎site/src/pages/WorkspacePage/WorkspaceNotifications/Notifications.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ const styles = {
123123
lineHeight:"1.5",
124124
borderTop:`1px solid${theme.palette.divider}`,
125125

126-
"&:first-child":{
126+
"&:first-of-type":{
127127
borderTop:0,
128128
},
129129
}),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp