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
const dispatch = createEventDispatcher()
let _space = space
$: if (_space !== space) {
_space = space
let oldSpace = space
$: if (oldSpace !== space) {
oldSpace = space
dispatch('change', space)
}
</script>

View File

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