mirror of
https://github.com/Steffo99/festa.git
synced 2024-12-22 14:44:21 +00:00
Fix nasty re-rendering bug
This commit is contained in:
parent
ff73ab681f
commit
16aad0eecb
1 changed files with 3 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
|||
import { Event } from "@prisma/client"
|
||||
import { useMemo } from "react"
|
||||
import { useCallback, useMemo } from "react"
|
||||
import { KeyedMutator } from "swr"
|
||||
import { ViewContent } from "../../generic/views/content"
|
||||
|
||||
|
@ -22,7 +22,7 @@ export const EventsActionEdit = ({ data, mutate }: EventsActionViewProps) => {
|
|||
<input
|
||||
type="text"
|
||||
value={name}
|
||||
onChange={e => mutate({ ...data, name: e.target.value }, { revalidate: false })}
|
||||
onChange={e => mutate((prev) => ({ ...prev!, name: e.target.value }), { revalidate: false })}
|
||||
/>
|
||||
),
|
||||
[mutate, name]
|
||||
|
@ -34,7 +34,7 @@ export const EventsActionEdit = ({ data, mutate }: EventsActionViewProps) => {
|
|||
<textarea
|
||||
rows={12}
|
||||
value={description}
|
||||
onChange={e => mutate({ ...data, description: e.target.value }, { revalidate: false })}
|
||||
onChange={e => mutate((prev) => ({ ...prev!, description: e.target.value }), { revalidate: false })}
|
||||
/>
|
||||
),
|
||||
[mutate, description]
|
||||
|
|
Loading…
Reference in a new issue