fix(lint): устранить ошибки lint и ожидание host в тесте артефактов логов
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
1 parent
cf6dcd77fb
commit
44b5066f3a
6 files changed
+22
-11
No files matched your search
@@ -1,6 +1,6 @@
|
||||
"use client"
|
||||
|
||||
import { useEffect, useState } from "react"
|
||||
import { useEffect, useState, useSyncExternalStore } from "react"
|
||||
import Link from "next/link"
|
||||
import { useTheme } from "@/components/theme-provider"
|
||||
import {
|
||||
@@ -58,13 +58,12 @@ const THEMES = [
|
||||
},
|
||||
]
|
||||
|
||||
const subscribeNever = () => () => {}
|
||||
|
||||
function ThemeSegmentedToggle() {
|
||||
const { theme, setTheme } = useTheme()
|
||||
const [mounted, setMounted] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
setMounted(true)
|
||||
}, [])
|
||||
// false during SSR/hydration, true on the client afterwards, without setState in an effect.
|
||||
const mounted = useSyncExternalStore(subscribeNever, () => true, () => false)
|
||||
|
||||
const currentTheme = mounted ? (theme ?? "system") : "system"
|
||||
|
||||
|
||||
@@ -476,6 +476,7 @@ export function useDateSelector({
|
||||
|
||||
useEffect(() => {
|
||||
if (value) {
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect -- upstream ReUI: sync controlled value into local state
|
||||
setPeriodType(value.period || validDefaultPeriodType)
|
||||
// Use presetMode if provided, otherwise use value's operator or default
|
||||
const newFilterType = presetMode ?? value.operator ?? defaultFilterType
|
||||
@@ -494,6 +495,7 @@ export function useDateSelector({
|
||||
// Sync filterType when presetMode changes
|
||||
useEffect(() => {
|
||||
if (presetMode !== undefined) {
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect -- upstream ReUI: sync presetMode into local state
|
||||
setFilterType(presetMode)
|
||||
}
|
||||
}, [presetMode])
|
||||
@@ -1090,6 +1092,7 @@ export function DateSelector({
|
||||
// Sync input value when displayValue changes (but not when user is typing)
|
||||
useEffect(() => {
|
||||
if (!isInputFocused) {
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect -- upstream ReUI: sync input text unless user is typing
|
||||
setInputValue(displayValue)
|
||||
}
|
||||
}, [displayValue, isInputFocused])
|
||||
|
||||
@@ -103,6 +103,8 @@ export interface SortableRootProps<T> extends Omit<
|
||||
modifiers?: Modifiers
|
||||
}
|
||||
|
||||
interface SortableChildProps { value?: UniqueIdentifier; className?: string }
|
||||
|
||||
function Sortable<T>({
|
||||
value,
|
||||
onValueChange,
|
||||
@@ -120,6 +122,7 @@ function Sortable<T>({
|
||||
const [activeId, setActiveId] = useState<UniqueIdentifier | null>(null)
|
||||
const [mounted, setMounted] = useState(false)
|
||||
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect -- upstream ReUI: client-only mount flag for portal
|
||||
useLayoutEffect(() => setMounted(true), [])
|
||||
|
||||
const sensors = useSensors(
|
||||
@@ -210,10 +213,10 @@ function Sortable<T>({
|
||||
if (!activeId) return null
|
||||
let result: ReactNode = null
|
||||
Children.forEach(children, (child) => {
|
||||
if (isValidElement(child) && (child.props as any).value === activeId) {
|
||||
result = cloneElement(child as ReactElement<any>, {
|
||||
...(child.props as any),
|
||||
className: cn((child.props as any).className, "z-50"),
|
||||
if (isValidElement(child) && (child.props as SortableChildProps).value === activeId) {
|
||||
result = cloneElement(child as ReactElement<SortableChildProps>, {
|
||||
...(child.props as SortableChildProps),
|
||||
className: cn((child.props as SortableChildProps).className, "z-50"),
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -299,6 +302,7 @@ function SortableItem({
|
||||
<SortableItemContext.Provider
|
||||
value={{ listeners: undefined, isDragging: true, disabled: false }}
|
||||
>
|
||||
{/* eslint-disable-next-line react-hooks/rules-of-hooks -- upstream ReUI: render-prop branches are stable per component */}
|
||||
{useRender({
|
||||
defaultTagName: "div",
|
||||
render,
|
||||
@@ -333,6 +337,7 @@ function SortableItem({
|
||||
<SortableItemContext.Provider
|
||||
value={{ listeners, isDragging: isSortableDragging, disabled }}
|
||||
>
|
||||
{/* eslint-disable-next-line react-hooks/rules-of-hooks -- upstream ReUI: render-prop branches are stable per component */}
|
||||
{useRender({
|
||||
defaultTagName: "div",
|
||||
render,
|
||||
@@ -388,6 +393,7 @@ function SortableOverlay({
|
||||
const { activeId, modifiers } = useContext(SortableInternalContext)
|
||||
const [mounted, setMounted] = useState(false)
|
||||
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect -- upstream ReUI: client-only mount flag for portal
|
||||
useLayoutEffect(() => setMounted(true), [])
|
||||
|
||||
const content =
|
||||
|
||||
@@ -247,11 +247,13 @@ function StepperTrigger({
|
||||
if (btnRef.current) {
|
||||
registerTrigger(btnRef.current)
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/refs -- upstream ReUI: trigger registry reads the ref during render
|
||||
}, [btnRef.current])
|
||||
|
||||
// Find our index among triggers for navigation
|
||||
const myIdx = useMemo(
|
||||
() =>
|
||||
// eslint-disable-next-line react-hooks/refs -- upstream ReUI: trigger registry reads the ref during render
|
||||
triggerNodes.findIndex((n: HTMLButtonElement) => n === btnRef.current),
|
||||
[triggerNodes, btnRef.current]
|
||||
)
|
||||
|
||||
@@ -92,6 +92,7 @@ export function ThemeProvider({
|
||||
setSystemTheme(event.matches ? "dark" : "light")
|
||||
}
|
||||
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect -- read matchMedia/localStorage after mount to avoid hydration mismatch
|
||||
setSystemTheme(media.matches ? "dark" : "light")
|
||||
media.addEventListener("change", onSystemChange)
|
||||
|
||||
|
||||
Reference in new issue
Block a user