Skip to content

Commit

Permalink
Optimize - only fetch bucket name when in fullview
Browse files Browse the repository at this point in the history
  • Loading branch information
TimCsaky committed Feb 1, 2024
1 parent 55a8707 commit c2e4708
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions frontend/src/components/object/ObjectProperties.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ import type { Bucket, COMSObject, Metadata } from '@/types';
// Props
type Props = {
objectId: string;
versionId?: string;
// versionId?: string;
bucketName: string;
fullView: boolean;
};
const props = withDefaults(defineProps<Props>(), {
versionId: undefined
// versionId: undefined
// bucketName: undefined
});
// Store
Expand All @@ -38,11 +40,14 @@ const updatedBy: Ref<string | undefined> = ref(undefined);
// Actions
async function load() {
object.value = objectStore.findObjectById(props.objectId);
await bucketStore.fetchBuckets({ bucketId: object.value?.bucketId });
bucket.value = bucketStore.findBucketById(object.value?.bucketId as string);
if (props.fullView) {
objectMetadata.value = metadataStore.findMetadataByObjectId(object.value?.id as string);
// get populate bucket
await bucketStore.fetchBuckets({ bucketId: object.value?.bucketId });
bucket.value = bucketStore.findBucketById(object.value?.bucketId as string);
// objectMetadata.value = metadataStore.findMetadataByObjectId(object.value?.id as string);
await userStore.fetchUsers({ userId: [object.value?.createdBy, object.value?.updatedBy] });
createdBy.value = getUserSearch.value.find((x) => x.userId === object.value?.createdBy)?.fullName;
updatedBy.value = getUserSearch.value.find((x) => x.userId === object.value?.updatedBy)?.fullName;
Expand Down

0 comments on commit c2e4708

Please sign in to comment.