Skip to content

feat: handle update build for dynamic params #18226

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

Merged
merged 16 commits into from
Jun 5, 2025

Conversation

jaaydenh
Copy link
Contributor

@jaaydenh jaaydenh commented Jun 4, 2025

@jaaydenh jaaydenh self-assigned this Jun 4, 2025
@jaaydenh jaaydenh requested a review from Copilot June 4, 2025 22:57
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds support for dynamic parameters during workspace build updates by wiring a feature flag through the UI, hooks, and API layers.

  • Introduce isDynamicParametersEnabled flag in batch actions, update dialogs, and mutation calls
  • Provide an opt-out hook (useDynamicParametersOptOut) and branch between classic/experimental parameter flows in multiple components
  • Extend API methods to fetch and apply “dynamic parameters” when the feature is enabled

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
site/src/modules/workspaces/WorkspaceUpdateDialogs.tsx Wire dynamic-params feature flag into update workspace mutation and dialogs
site/src/hooks/useDynamicParametersOptOut.ts New hook to read opt-out state from localStorage
site/src/api/api.ts Add getDynamicParameters and branch in updateWorkspace/changeWorkspaceVersion for dynamic vs. rich parameters
site/src/api/queries/workspaces.ts Pass isDynamicParametersEnabled through changeVersion and updateWorkspace query definitions
site/src/pages/** Pass feature flag and templateVersionId through workspace pages and dialogs, refactor various routers
site/src/components/Dialog/Dialog.tsx Expose additional exports and update spacing/typography in dialog primitives
Comments suppressed due to low confidence (2)

site/src/modules/workspaces/WorkspaceUpdateDialogs.tsx:60

  • [nitpick] The boolean flag is named dynamicParametersEnabled here but isDynamicParametersEnabled elsewhere; consider standardizing on the is* prefix for consistency.
const dynamicParametersEnabled = experiments.includes("dynamic-parameters");

site/src/hooks/useDynamicParametersOptOut.ts:1

  • New feature logic in this hook isn’t covered by tests; consider adding unit tests for the opt-out default behavior and localStorage reads.
import { useQuery } from "react-query";

jaaydenh and others added 10 commits June 4, 2025 22:59
The updateWorkspace function now requires additional parameters:
- buildParameters (array, defaults to [])
- isDynamicParametersEnabled (boolean, defaults to false)

Updated all test calls to include these parameters to fix test failures.
When the dynamic-parameters experiment is not enabled, the parameter
dialogs were showing a loader indefinitely instead of the classic
parameter dialog. This was causing e2e tests to fail because they
couldn't find the parameter fields.

Fixed by:
- Only showing loader when experiment is enabled AND optOut data is loading
- Using classic dialog when experiment is disabled OR user opted out
- This ensures e2e tests work correctly without the experiment flag
@jaaydenh jaaydenh marked this pull request as ready for review June 5, 2025 17:25
@jaaydenh jaaydenh requested a review from Emyrk June 5, 2025 17:26
@jaaydenh jaaydenh merged commit 508fba8 into main Jun 5, 2025
33 checks passed
@jaaydenh jaaydenh deleted the jaaydenh/update-build-parameters branch June 5, 2025 20:35
@github-actions github-actions bot locked and limited conversation to collaborators Jun 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update BuildParametersDialog to use DynamicParameters
2 participants