Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Refresh affect trackers after filing trackers #472

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

### Fixed
* Corrected BZ link overlapping flaw promotion button (`OSIDB-3529`)
* Refresh trackers after filing new trackers (`OSIDB-3483`)

### Changed
* Allow empty impact on flaw (`OSIDB-3596`)
Expand Down
4 changes: 2 additions & 2 deletions src/components/FlawTrackers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const props = defineProps<{
const emit = defineEmits<{
'affect:track-selected': [value: ZodAffectType[]];
'affect:track-single': [value: ZodAffectType];
'affects:refresh': [];
'affects-trackers:refresh': [];
}>();

const settingsStore = useSettingsStore();
Expand Down Expand Up @@ -310,7 +310,7 @@ const {
v-if="showTrackerManager"
:relatedFlaws="relatedFlaws"
:flaw="flaw"
@affects-trackers:refresh="emit('affects:refresh')"
@affects-trackers:refresh="emit('affects-trackers:refresh')"
/>
</div>
</div>
Expand Down
15 changes: 14 additions & 1 deletion src/composables/useFlawModel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { computed, ref } from 'vue';
import { computed, ref, type Ref } from 'vue';

import { useRouter } from 'vue-router';
import { modifyPath } from 'ramda';
Expand All @@ -10,6 +10,7 @@ import { useFlawCommentsModel } from '@/composables/useFlawCommentsModel';
import { useFlawAttributionsModel } from '@/composables/useFlawAttributionsModel';

import {
getFlaw,
getFlawBugzillaLink,
getFlawOsimLink,
postFlaw,
Expand Down Expand Up @@ -239,3 +240,15 @@ function flawErrors(flaw: ZodFlawType) {

return mirroredFlaw;
}

export async function refreshFlawAffectTrackers(flaw: Ref<ZodFlawType>) {
const freshFlaw = await getFlaw(flaw.value.uuid);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add some kind of loader to this action?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, now that the trackers are handled asynchronous, I'm not sure about UX, we are realoading things but it may occur that nothing changes, users are already aware of that, but it can be confusing

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hrm, maybe we should the delay should be long just to grab the flaw, but that might be best to trigger a loading state

if (freshFlaw) {
flaw.value.affects.forEach((affect) => {
const freshAffect = freshFlaw.affects.find(freshAffect => freshAffect.uuid === affect.uuid);
if (freshAffect) {
affect.trackers = freshAffect.trackers;
}
});
}
}