mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 15:39:13 +00:00
## Context We've been seeing many `NotFoundError: Failed to execute 'removeChild' on 'Node'` and `NotFoundError: Failed to execute 'insertBefore' on 'Node'` events on Sentry which are historically known to be caused by Google Translate in the browser. There's technically no _right way_ to address this unfortunately, but one of the solutions which should address most of these issues is to wrap any dynamic text within a span - we've considered that quite a while back tbh but never took the time to do this until today with the help of Claude. Although just a heads up that it might not necessarily completely eradicate those issues. Also added an eslint rule which should prevent future occurences of this <img width="1264" height="192" alt="image" src="https://github.com/user-attachments/assets/b2c32ea0-45a2-4ccd-82fe-1a859905fc29" />
63 lines
2.2 KiB
TypeScript
63 lines
2.2 KiB
TypeScript
import { lintInfoMap } from '../Linter/Linter.utils'
|
|
import { LintException } from '@/data/lint/lint-rules-query'
|
|
import { Member } from '@/data/organizations/organization-members-query'
|
|
|
|
export const generateRuleText = (e: LintException, member?: Member) => {
|
|
const lintName = lintInfoMap.find((x) => x.name === e.lint_name)?.title
|
|
|
|
if (e.is_disabled) {
|
|
return `Ignore "${lintName}" for ${!e.assigned_to ? 'all project members' : `${member?.username ?? member?.primary_email}`}`
|
|
} else {
|
|
return `"${lintName}" is only visible to ${member?.username} `
|
|
}
|
|
}
|
|
|
|
export const generateRuleDescription = ({
|
|
name,
|
|
member,
|
|
disabled,
|
|
}: {
|
|
name?: string
|
|
member?: Member
|
|
disabled: boolean
|
|
}) => {
|
|
const lint = lintInfoMap.find((x) => x.name === name)
|
|
return (
|
|
<>
|
|
<p className="font-mono uppercase text-xs text-foreground-lighter">What this rule means:</p>
|
|
<p className="mb-0!">
|
|
The "{lint?.title}" lint will be{' '}
|
|
{disabled ? (
|
|
<span>{`ignored for ${!!member ? `this user only` : 'this project'}`}</span>
|
|
) : (
|
|
<span>{`visible to ${!!member ? `this user only` : ''}`}</span>
|
|
)}
|
|
</p>
|
|
<p className="text-foreground-light">
|
|
{!!member ? (
|
|
disabled ? (
|
|
<>
|
|
Only {member.username ?? member.primary_email}{' '}
|
|
<span>will no longer see this lint in the</span>{' '}
|
|
<span className="capitalize">{lint?.category}</span>{' '}
|
|
<span>Advisor, the lint will still be visible to all other project members</span>
|
|
</>
|
|
) : (
|
|
<>
|
|
Only {member.username ?? member.primary_email} <span>will see this lint in the</span>{' '}
|
|
<span className="capitalize">{lint?.category}</span>{' '}
|
|
<span>Advisor, the lint will no longer be visible to all other project members</span>
|
|
</>
|
|
)
|
|
) : (
|
|
<>
|
|
All project members will no longer see this lint in the{' '}
|
|
<span className="capitalize">{lint?.category}</span> Advisor, nor receive notifications
|
|
via emails about this lint
|
|
</>
|
|
)}
|
|
</p>
|
|
</>
|
|
)
|
|
}
|