fix: category title input reverts to span on empty string (#699)

Fixes https://github.com/revoltchat/revite/issues/693
This commit is contained in:
Leda 2023-01-24 17:59:31 +00:00 committed by GitHub
parent e34c5c99fe
commit 2f43a2c32d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -340,11 +340,13 @@ function ListElement({
const save = useCallback(() => {
setEditing(undefined);
if (editing !== "") {
setTitle!(editing!);
}
}, [editing, setTitle]);
useEffect(() => {
if (!editing) return;
if (editing === undefined) return;
function onClick(ev: MouseEvent) {
if ((ev.target as HTMLElement)?.id !== category.id) {
@ -368,7 +370,7 @@ function ListElement({
<div className="inner">
<Row>
<KanbanListHeader {...provided.dragHandleProps}>
{editing ? (
{editing !== undefined ? (
<input
value={editing}
onChange={(e) =>