fix: suppress hydration warnings in JiraLogs, MarkdownEditor, and NotesList components

This commit is contained in:
Julien Froidefond
2025-10-16 05:17:41 +02:00
parent 7952459b42
commit a4188b09e5
4 changed files with 9 additions and 5 deletions

View File

@@ -126,7 +126,10 @@ export function JiraLogs({ className = '' }: JiraLogsProps) {
>
<div className="flex items-center justify-between mb-2">
{getStatusBadge(log.status)}
<span className="text-xs text-[var(--muted-foreground)]">
<span
className="text-xs text-[var(--muted-foreground)]"
suppressHydrationWarning
>
{formatDistanceToNow(parseDate(log.createdAt), {
addSuffix: true,
locale: fr,

View File

@@ -305,9 +305,9 @@ export function MarkdownEditor({
return () => document.removeEventListener('keydown', handleKeyDown);
}, [handleKeyDown]);
// Auto-save
// Auto-save (uniquement en mode édition)
useEffect(() => {
if (autoSave && hasUnsavedChanges) {
if (autoSave && hasUnsavedChanges && isEditing) {
if (autoSaveTimeoutRef.current) {
clearTimeout(autoSaveTimeoutRef.current);
}
@@ -322,7 +322,7 @@ export function MarkdownEditor({
}
};
}
}, [value, autoSave, hasUnsavedChanges, handleSave]);
}, [value, autoSave, hasUnsavedChanges, isEditing, handleSave]);
// Détecter les changements
useEffect(() => {

View File

@@ -202,7 +202,7 @@ export function NotesList({
<div className="flex items-center gap-2 text-xs text-[var(--muted-foreground)]">
<Calendar className="w-3 h-3" />
<span>
<span suppressHydrationWarning>
{formatDistanceToNow(new Date(note.updatedAt), {
addSuffix: true,
locale: fr,

View File

@@ -3,6 +3,7 @@ import CredentialsProvider from 'next-auth/providers/credentials';
import { usersService } from '@/services/users';
export const authOptions: NextAuthOptions = {
secret: process.env.NEXTAUTH_SECRET,
providers: [
CredentialsProvider({
name: 'credentials',