Skip to content

feat(NES-1601): default Copy To Team dialog to active team#9074

Open
jianwei1 wants to merge 3 commits intomainfrom
jianweichong/nes-1601-set-dialog-default-to-current-team-when-using-team-templates
Open

feat(NES-1601): default Copy To Team dialog to active team#9074
jianwei1 wants to merge 3 commits intomainfrom
jianweichong/nes-1601-set-dialog-default-to-current-team-when-using-team-templates

Conversation

@jianwei1
Copy link
Copy Markdown
Contributor

Summary

  • Pre-fill the Copy To Team dialog's team selector with the user's active team instead of leaving it empty.
  • Fixes the extra click Lucinda flagged when using TEAM Templates on the team she is already on (NES-1601, Slack thread).
  • Fully client-side. The JourneyDuplicate mutation already accepts teamId from the client, so no api-journeys changes are needed.

What changed

  • libs/journeys/ui/src/components/CopyToTeamDialog/CopyToTeamDialog.tsx
    • Destructured activeTeam from useTeam().
    • initialValues.teamSelect now defaults to activeTeam?.id ?? (teams.length === 1 ? teams[0].id : '').
    • Formik's enableReinitialize: true is already on, so the form re-initializes cleanly once activeTeam resolves from the async GetLastActiveTeamIdAndTeams query.

Scope note

CopyToTeamDialog is also reused by DuplicateJourneyMenuItem. The default naturally improves that flow too — there was no benefit to conditionally gating only for team templates (and doing so would have required a new prop). All usage sites share the better default.

Testing

  • Added two unit tests in CopyToTeamDialog.spec.tsx:
    • Multi-team user with an active team → selector pre-fills with that team.
    • Multi-team user with no active team → selector stays empty.
  • Existing 30 tests in CopyToTeamDialog.spec.tsx still pass.
  • CopyToTeamMenuItem.spec.tsx (9 tests) and DuplicateJourneyMenuItem.spec.tsx (6 tests) pass unchanged.
  • TemplateView suite (19 files, 156 tests) passes.
  • nx lint journeys-ui clean (no new warnings).
  • nx type-check journeys-ui clean.

Post-Deploy Monitoring & Validation

No additional operational monitoring required: this is a client-only default-value change on a form field. The mutation shape and payloads are unchanged, there are no new error paths, and the fallback preserves prior behaviour when activeTeam is not resolved.

When a user opens CopyToTeamDialog (from Use-this-Template on a team
template or from a journey's Duplicate menu), pre-fill the team selector
with the user's active team instead of leaving it empty. Falls back to
the existing single-team/empty behaviour when no active team is
resolved.

Fully client-side — the JourneyDuplicate mutation already accepts teamId
from the client, so no api-journeys changes are needed.
@linear
Copy link
Copy Markdown

linear Bot commented Apr 24, 2026

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 24, 2026

Warning

Rate limit exceeded

@autofix-ci[bot] has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 54 minutes and 31 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 54 minutes and 31 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 197c784b-bd30-4762-bed8-3da3d264584e

📥 Commits

Reviewing files that changed from the base of the PR and between 762cfe0 and 633926c.

📒 Files selected for processing (3)
  • docs/plans/2026-04-24-001-feat-default-copy-to-team-dialog-to-active-team-plan.md
  • libs/journeys/ui/src/components/CopyToTeamDialog/CopyToTeamDialog.spec.tsx
  • libs/journeys/ui/src/components/CopyToTeamDialog/CopyToTeamDialog.tsx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jianweichong/nes-1601-set-dialog-default-to-current-team-when-using-team-templates

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@jianwei1 jianwei1 self-assigned this Apr 24, 2026
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Apr 24, 2026

🤖 Nx Cloud AI Fix Eligible

An automatically generated fix could have helped fix failing tasks for this run, but Self-healing CI is disabled for this workspace. Visit workspace settings to enable it and get automatic fixes in future runs.

To disable these notifications, a workspace admin can disable them in workspace settings.


View your CI Pipeline Execution ↗ for commit 633926c

Command Status Duration Result
nx run journeys-e2e:e2e ❌ Failed 36s View ↗
nx run journeys-admin-e2e:e2e ✅ Succeeded 27s View ↗
nx run watch-e2e:e2e ✅ Succeeded 21s View ↗
nx run resources-e2e:e2e ✅ Succeeded 16s View ↗
nx run videos-admin-e2e:e2e ✅ Succeeded 4s View ↗
nx run-many --target=vercel-alias --projects=jo... ✅ Succeeded 2s View ↗
nx run-many --target=upload-sourcemaps --projec... ✅ Succeeded 9s View ↗
nx run-many --target=deploy --projects=journeys... ✅ Succeeded 2m 42s View ↗
Additional runs (12) ✅ Succeeded ... View ↗

☁️ Nx Cloud last updated this comment at 2026-04-24 01:13:31 UTC

@github-actions github-actions Bot requested a deployment to Preview - resources April 24, 2026 00:57 Pending
@github-actions github-actions Bot requested a deployment to Preview - journeys April 24, 2026 00:57 Pending
@github-actions github-actions Bot requested a deployment to Preview - journeys-admin April 24, 2026 00:57 Pending
@github-actions github-actions Bot requested a deployment to Preview - videos-admin April 24, 2026 00:57 Pending
Collapses the two default-team-selection tests to a single render helper
so they differ only in the one input they vary — the lastActiveTeamId —
plus their assertion. Saves ~40 lines of copy-paste scaffolding.
@github-actions github-actions Bot requested a deployment to Preview - journeys April 24, 2026 01:01 Pending
@github-actions github-actions Bot requested a deployment to Preview - videos-admin April 24, 2026 01:01 Pending
@github-actions github-actions Bot requested a deployment to Preview - journeys-admin April 24, 2026 01:02 Pending
@github-actions github-actions Bot requested a deployment to Preview - resources April 24, 2026 01:02 Pending
@github-actions github-actions Bot temporarily deployed to Preview - journeys-admin April 24, 2026 01:05 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - videos-admin April 24, 2026 01:05 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - journeys April 24, 2026 01:05 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - resources April 24, 2026 01:05 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - watch April 24, 2026 01:06 Inactive
@github-actions
Copy link
Copy Markdown
Contributor

The latest updates on your projects.

Name Status Preview Updated (UTC)
journeys ✅ Ready journeys preview Fri Apr 24 13:08:51 NZST 2026

@jianwei1 jianwei1 requested a review from csiyang April 24, 2026 01:09
@github-actions
Copy link
Copy Markdown
Contributor

The latest updates on your projects.

Name Status Preview Updated (UTC)
videos-admin ✅ Ready videos-admin preview Fri Apr 24 13:09:15 NZST 2026

@github-actions
Copy link
Copy Markdown
Contributor

The latest updates on your projects.

Name Status Preview Updated (UTC)
resources ✅ Ready resources preview Fri Apr 24 13:09:16 NZST 2026

@github-actions
Copy link
Copy Markdown
Contributor

The latest updates on your projects.

Name Status Preview Updated (UTC)
watch ✅ Ready watch preview Fri Apr 24 13:09:18 NZST 2026

@github-actions
Copy link
Copy Markdown
Contributor

The latest updates on your projects.

Name Status Preview Updated (UTC)
journeys-admin ✅ Ready journeys-admin preview Fri Apr 24 13:10:04 NZST 2026

@blacksmith-sh
Copy link
Copy Markdown
Contributor

blacksmith-sh Bot commented Apr 24, 2026

Found 1 test failure on Blacksmith runners:

Failure

Test View Logs
src/e2e/journeys.spec.ts/journeys View Logs

Fix in Cursor

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