fix: add eslint-disable comments for set-state-in-effect rule in playground
The new react-hooks/set-state-in-effect ESLint rule flags setState calls in useEffect hooks. These patterns are intentional in these components: - ChatHeader: setMounted for hydration safety - MessageBubble: setPartTimings for streaming state tracking - SettingsSidebar: setEnvVars for localStorage initialization 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
91fc8799b7
commit
83f00c8a74
3 changed files with 5 additions and 2 deletions
|
|
@ -1,8 +1,8 @@
|
|||
'use client';
|
||||
|
||||
import { Button } from '@tpmjs/ui/Button/Button';
|
||||
import { useTheme } from 'next-themes';
|
||||
import Link from 'next/link';
|
||||
import { useTheme } from 'next-themes';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
interface ChatHeaderProps {
|
||||
|
|
@ -13,8 +13,9 @@ export function ChatHeader({ onClear }: ChatHeaderProps): React.ReactElement {
|
|||
const { theme, setTheme } = useTheme();
|
||||
const [mounted, setMounted] = useState(false);
|
||||
|
||||
// Avoid hydration mismatch
|
||||
// Avoid hydration mismatch - this is intentional for SSR
|
||||
useEffect(() => {
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect
|
||||
setMounted(true);
|
||||
}, []);
|
||||
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ export function MessageBubble({
|
|||
|
||||
const now = Date.now();
|
||||
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect
|
||||
setPartTimings((prev) => {
|
||||
const updated = new Map(prev);
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ export function SettingsSidebar(): React.ReactElement {
|
|||
try {
|
||||
const stored = localStorage.getItem(ENV_STORAGE_KEY);
|
||||
if (stored) {
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect
|
||||
setEnvVars(JSON.parse(stored));
|
||||
}
|
||||
} catch (error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue