Frontend: Fixed props handling in the bookmarks column and added dynamic updating of MkAvatars
ci/woodpecker/push/ociImagePush Pipeline was successful Details

This commit is contained in:
Natty 2023-09-08 22:29:26 +02:00
parent acea6c2434
commit f39495fbb4
Signed by: natty
GPG Key ID: BF6CB659ADEE60EC
2 changed files with 24 additions and 17 deletions

View File

@ -7,7 +7,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref } from "vue"; import { onMounted, ref, watch } from "vue";
import * as os from "@/os"; import * as os from "@/os";
import { User } from "calckey-js/built/entities"; import { User } from "calckey-js/built/entities";
@ -21,6 +21,15 @@ onMounted(async () => {
users.value = await os.api("users/show", { users.value = await os.api("users/show", {
userIds: props.userIds, userIds: props.userIds,
}); });
watch(
() => props.userIds,
async (userIds) => {
users.value = await os.api("users/show", {
userIds,
});
}
);
}); });
</script> </script>

View File

@ -10,7 +10,7 @@
><span style="margin-left: 8px">{{ column.name }}</span> ><span style="margin-left: 8px">{{ column.name }}</span>
</template> </template>
<MkAvatars :key="userList" :userIds="userList" /> <MkAvatars :userIds="userList" />
</XColumn> </XColumn>
</template> </template>
@ -35,34 +35,32 @@ const emit = defineEmits<{
const userList = ref<User["id"][]>([]); const userList = ref<User["id"][]>([]);
async function fetchUserList() { async function fetchUserList(id: string | null) {
if (id === null) {
userList.value = [];
return;
}
userList.value = ( userList.value = (
await os.api("users/lists/show", { await os.api("users/lists/show", {
listId: props.column.listId!, listId: id,
}) })
).userIds; ).userIds;
} }
watch($$(props.column.listId), () => { onMounted(async () => {
if (props.column.listId == null) { watch(
return; () => props.column.listId,
} (id) => fetchUserList(id ?? null)
);
fetchUserList(); await fetchUserList(props.column.listId ?? null);
}); });
if (props.column.listId == null) { if (props.column.listId == null) {
setList(); setList();
} }
onMounted(() => {
if (props.column.listId == null) {
return;
}
fetchUserList();
});
async function setList() { async function setList() {
const lists = await os.api("users/lists/list"); const lists = await os.api("users/lists/list");
const { canceled, result: list } = await os.select({ const { canceled, result: list } = await os.select({