feature/projects-all-the-way-down #3323

Merged
konrad merged 123 commits from feature/projects-all-the-way-down into main 2023-05-30 10:09:40 +00:00
Showing only changes of commit afaf1846ec - Show all commits

View File

@ -32,7 +32,7 @@
<ProjectCardGrid :projects="projectHistory" v-cy="'projectCardGrid'" />
</div>
<ShowTasks
v-if="hasProjects"
v-if="projectStore.hasProjects"
class="show-tasks"
:key="showTasksKey"
/>
@ -80,7 +80,6 @@ const projectHistory = computed(() => {
const migratorsEnabled = computed(() => configStore.availableMigrators?.length > 0)
const hasTasks = computed(() => baseStore.hasTasks)
const hasProjects = computed(() => projectStore.hasProjects)
const loading = computed(() => taskStore.isLoading)
konrad marked this conversation as resolved Outdated

This should be a computed of the store, like hasTasks.
Shouldn't we check the length here (projectStore.projects?.length)?

This should be a computed of the store, like `hasTasks`. Shouldn't we check the length here (`projectStore.projects?.length`)?

projects is an object, so checking the length of it won't work.

`projects` is an object, so checking the length of it won't work.

Moved it to the store.

Moved it to the store.

Then Object.keys?.length

Then `Object.keys?.length`

Then Object.keys?.length

Wouldn't that cause a call to Object.keys? I think my solution is faster.

> Then `Object.keys?.length` Wouldn't that cause a call to `Object.keys`? I think my solution is faster.

Checked it: https://jsbench.me/hslfseq93y/1

Using Object.keys really is slower, and by a lot.

Checked it: https://jsbench.me/hslfseq93y/1 Using `Object.keys` really is slower, and by a lot.

True. Using a Map with size would probably be the perfect solution here. But that is something for another time.

True. Using a Map with size would probably be the perfect solution here. But that is something for another time.

Don't wrap computed in computed. use projectStore.hasProjects directly

Don't wrap computed in computed. use `projectStore.hasProjects` directly

Done

Done
const deletionScheduledAt = computed(() => parseDateOrNull(authStore.info?.deletionScheduledAt))