Skip to content

[Fix] Homepage stays on Auto when only one environment exists#497

Merged
mrubens merged 2 commits into
developfrom
fix/default-sole-environment-homepage-3233n0gga8ro4
Jul 17, 2026
Merged

[Fix] Homepage stays on Auto when only one environment exists#497
mrubens merged 2 commits into
developfrom
fix/default-sole-environment-homepage-3233n0gga8ro4

Conversation

@roomote-roomote

@roomote-roomote roomote-roomote Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Opened on behalf of Matt Rubens. Follow up by mentioning @roomote-roomote, in the web UI, or in Slack.

Related issue

N/A — internal request from Slack.

Why this PR exists

  • A maintainer explicitly invited this PR in the linked issue or discussion
  • I am a maintainer / this is internal Roomote work

What changed

When a deployment has only one environment, the homepage workspace control now defaults to that environment instead of staying on Auto.

This covers:

  1. Empty → one after setup — defaulting no longer locks while the environments list is still empty.
  2. Direct homepage load with Auto storage — Home waits for environments before restoring Auto, and selects the sole environment itself so it cannot overwrite a child default and leave the form stuck on Auto.
  3. Programmatic Auto reset — the workspace selector re-applies the sole environment when the form is reset to Auto without an explicit user choice (menu selection still keeps Auto when the user picks it).
  4. Setup/onboarding redirect — refresh the environments list so redirects can include environmentId when available.

How it was tested

  • Unit tests for sole-environment defaulting, empty→one transition, multi-environment Auto, programmatic Auto reset retry
  • Home integration tests for Auto storage + sole/multi environments
  • Web TypeScript check and pre-push suite
  • Browser proof: cold homepage load with Auto storage settles on the sole environment

Screenshots

Homepage cold load with Auto storage defaults workspace to the sole environment

Checklist

  • The PR title follows the repo convention: [Fix], [Feat], [Improve], [Refactor], [Docs], or [Chore] followed by a user-facing description
  • This PR is small and scoped to one change
  • pnpm lint and pnpm check-types pass locally
  • I added tests or included a clear manual validation note above
  • I removed secrets, tokens, private keys, and customer data from code, logs, and screenshots
  • If this change should appear in the changelog, I ran pnpm changeset

Keep the homepage workspace default open while environments are empty so the first system-created environment is selected instead of Auto, and refresh the environments list when leaving setup/onboarding so the redirect can include environmentId.
@roomote-roomote

roomote-roomote Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

No new code issues found. See task

  • apps/web/src/components/tasks/SelectEnvironmentOrRepository.tsx:148-158 The direct homepage-load case can still finish on Auto when the sole environment is already loaded. This child effect selects the environment and marks defaulting complete before Home's mount effect restores the persisted Auto workspace; the parent effect then overwrites the form back to Auto, and hasAppliedDefaultWorkspace prevents a retry. Please coordinate defaulting with workspace restoration and cover the integrated Home + selector mount rather than only the isolated selector.

Reviewed 4e3d2ac

@roomote-roomote

roomote-roomote Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

Fixed the homepage Auto race with workspace restoration.

Addressed

  • Home now waits for environments before restoring Auto storage and defaults to the sole environment when there is exactly one
  • Selector re-applies sole-env default after a programmatic reset to Auto (explicit menu choice of Auto is still preserved)
  • Added Home + selector tests for Auto storage sole/multi cases and programmatic overwrite retry

Pushed in 4e3d2ac

…tore

Wait for environments before restoring an Auto preference so the sole environment becomes the load default, and re-apply that default when Home wrote Auto over a programmatic selection without an explicit user choice.
@mrubens
mrubens marked this pull request as ready for review July 17, 2026 16:12
@mrubens
mrubens merged commit 3e59f5b into develop Jul 17, 2026
16 checks passed
@mrubens
mrubens deleted the fix/default-sole-environment-homepage-3233n0gga8ro4 branch July 17, 2026 16:12
@roomote-roomote roomote-roomote Bot mentioned this pull request Jul 17, 2026
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