UBERF-5886: fix todo reorder on click (#4904)

Signed-off-by: Eduard Aksamitov <e@euaaaio.ru>
This commit is contained in:
Eduard Aksamitov 2024-03-08 18:29:44 +03:00 committed by GitHub
parent 5ce079cf3d
commit 6eefe88b60
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 7 deletions

View File

@ -42,9 +42,9 @@
export let create: ObjectCreate | undefined = undefined export let create: ObjectCreate | undefined = undefined
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
let _space = space let oldSpace = space
$: if (_space !== space) { $: if (oldSpace !== space) {
_space = space oldSpace = space
dispatch('change', space) dispatch('change', space)
} }
</script> </script>

View File

@ -101,9 +101,13 @@
object.visibility = visibility object.visibility = visibility
} }
async function spaceChange (space: Ref<Space>) { async function spaceChange (space: Space | null) {
await client.update(object, { attachedSpace: space }) const oldSpace = object.attachedSpace ?? undefined
object.attachedSpace = space const newSpace = space?._id ?? undefined
if (newSpace !== oldSpace) {
await client.update(object, { attachedSpace: newSpace })
object.attachedSpace = newSpace
}
} }
</script> </script>
@ -171,7 +175,7 @@
autoSelect={false} autoSelect={false}
readonly={object._class === time.class.ProjectToDo} readonly={object._class === time.class.ProjectToDo}
space={object.attachedSpace} space={object.attachedSpace}
on:change={(e) => spaceChange(e.detail)} on:object={(e) => spaceChange(e.detail)}
/> />
</div> </div>
</div> </div>