mirror of
https://github.com/Steffo99/festa.git
synced 2024-12-22 22:54:22 +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 { Event } from "@prisma/client"
|
||||||
import { useMemo } from "react"
|
import { useCallback, useMemo } from "react"
|
||||||
import { KeyedMutator } from "swr"
|
import { KeyedMutator } from "swr"
|
||||||
import { ViewContent } from "../../generic/views/content"
|
import { ViewContent } from "../../generic/views/content"
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ export const EventsActionEdit = ({ data, mutate }: EventsActionViewProps) => {
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
value={name}
|
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]
|
[mutate, name]
|
||||||
|
@ -34,7 +34,7 @@ export const EventsActionEdit = ({ data, mutate }: EventsActionViewProps) => {
|
||||||
<textarea
|
<textarea
|
||||||
rows={12}
|
rows={12}
|
||||||
value={description}
|
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]
|
[mutate, description]
|
||||||
|
|
Loading…
Reference in a new issue