Skip to content

refactor: optimize outdated components lookup#2464

Draft
maxy-shpfy wants to merge 1 commit into
masterfrom
06-28-refactor_optimize_outdated_components_lookup
Draft

refactor: optimize outdated components lookup#2464
maxy-shpfy wants to merge 1 commit into
masterfrom
06-28-refactor_optimize_outdated_components_lookup

Conversation

@maxy-shpfy

@maxy-shpfy maxy-shpfy commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Description

Contributes to https://github.com/Shopify/oasis-frontend/issues/670

Extracts the findMostRecentComponents call into its own useMostRecentComponents hook with a dedicated query key (["outdated-components", "most-recent-map"]), allowing it to be cached independently from the per-component outdated check. This prevents the published components map from being recomputed every time the set of used components changes.

Additionally, GitHub component update overrides are now tracked in a separate githubOverrides map rather than mutating mostRecentComponents directly. The outdated components filter and mapping logic now checks githubOverrides first, falling back to mostRecentComponents. The stale time for both queries is unified using a shared OUTDATED_COMPONENTS_STALE_TIME constant (1 hour), replacing the previous hardcoded 1000 * 60 * 5 (5 minutes).

Related Issue and Pull requests

Type of Change

  • Bug fix
  • New feature
  • Improvement
  • Cleanup/Refactor
  • Breaking change
  • Documentation update

Checklist

  • I have tested this does not break current pipelines / runs functionality
  • I have tested the changes on staging

Screenshots (if applicable)

Test Instructions

  1. Open a pipeline that contains outdated components (both registry-published and GitHub-sourced).
  2. Verify that the outdated component indicators still appear correctly.
  3. Confirm that navigating away and back does not trigger unnecessary refetches of the published components map within the 1-hour stale window.
  4. Verify that GitHub component overrides still take precedence over the published components map when determining the most recent version.

Additional Comments

The removal of the if (githubComponents.length > 0) guard is intentional — the loop is now unconditional, which is functionally equivalent and simplifies the control flow.

@github-actions

github-actions Bot commented Jun 29, 2026

Copy link
Copy Markdown

🎩 Preview

A preview build has been created at: 06-28-refactor_optimize_outdated_components_lookup/e01f029

maxy-shpfy commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@maxy-shpfy maxy-shpfy changed the base branch from 06-28-fix_disable_upgraded_components_lookup_in_search_results to graphite-base/2464 June 29, 2026 18:10
@maxy-shpfy maxy-shpfy force-pushed the graphite-base/2464 branch from 2d6cb5a to cc8a5bd Compare June 29, 2026 18:17
@maxy-shpfy maxy-shpfy force-pushed the 06-28-refactor_optimize_outdated_components_lookup branch from ebe4da6 to 1a84aa3 Compare June 29, 2026 18:17
@maxy-shpfy maxy-shpfy changed the base branch from graphite-base/2464 to 06-28-fix_disable_upgraded_components_lookup_in_search_results June 29, 2026 18:17
@maxy-shpfy maxy-shpfy changed the base branch from 06-28-fix_disable_upgraded_components_lookup_in_search_results to graphite-base/2464 June 29, 2026 18:27
@maxy-shpfy maxy-shpfy force-pushed the graphite-base/2464 branch from cc8a5bd to f0e58ed Compare June 29, 2026 18:27
@maxy-shpfy maxy-shpfy force-pushed the 06-28-refactor_optimize_outdated_components_lookup branch from 1a84aa3 to af95044 Compare June 29, 2026 18:27
@graphite-app graphite-app Bot changed the base branch from graphite-base/2464 to master June 29, 2026 18:28
@maxy-shpfy maxy-shpfy force-pushed the 06-28-refactor_optimize_outdated_components_lookup branch from af95044 to e01f029 Compare June 29, 2026 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant