Fetch work item linked resources in their own query

What does this MR do and why?

This MR splits the loading of linkedResources widget from main work items query (i.e. namespaceWorkItem) into its own query that loads separate from base query, allowing us to bring down the query complexity of base query.

Implementation notes

Here's a high level summary of what this MR does:

  • We've split the linkedResources widget from base work item query to its own query and subscription.
  • When page loads, namespaceWorkItem would fetch only type for this widget, which is returned only if widget is supported on a given work item type, this also controls widget visibility like it used to in master.
  • The work_items/components/work_item_linked_resources.vue component now owns its query & subscription to fetch available linked resources, as well as observes work item for updates (eg; usage of /zoom and /remove_zoom quick actions).
    • Having a subscription ensures that real-time behaviour or component remains intact even after query has split.
  • If you enabled work_item_features_field flag globally on GDK and access any work item anonymously, you'd still see the error Work Item not found as this MR alone won't solve that issue, it is part of a series of MRs where we're splitting widgets into their own queries.
    • linkedResources - This MR
    • currentUserTodos - !252573 (merged)
    • crmContacts - !252569 (merged)
    • Only after all 3 MRs get merged is when we'll be able to access work items anonymously with FF enabled globally, assuming something else isn't added to main query again to breach complexity. 😬
  • I haven't attached any recordings to MR description as behaviour is same as what you'd notice in master, except that there's only one extra query, a dedicated workItemLinkedResources to fetch any attached Zoom links.

References

Note that this MR depends on !252530 (merged), so it cannot be merged until that merges.

Screenshots or screen recordings

NA, no visual change. The widget renders and behaves the same, it just gets its data from its own query.

How to set up and validate locally

  1. Enable the flag with Feature.enable(:work_item_features_field).
  2. Open a work item and add a Zoom link with /zoom https://zoom.us/j/123456789.
  3. Confirm the Resources card appears with the link.
  4. In the network tab, confirm workItemLinkedResources fires exactly once and namespaceWorkItem fires once.
  5. Open a work item without a Zoom link and confirm the Resources card doesn't show.
  6. Remove the link with /remove_zoom and confirm the card disappears.
  7. Repeat with the flag disabled to check the widgets path.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Kushal Pandya

Merge request reports

Loading
Loading