• keppo-bot[bot]'s avatar
    fix: persist GitHub sync state across Publish tab navigation (#3151) · 7ca7b0c1
    keppo-bot[bot] 提交于
    Fixes #3139 
    
    ## Summary
    - Fixes the bug where clicking **Sync to GitHub** on the Publish tab and
    navigating away before the push finishes dropped the in-flight state —
    the push actually continued in the main process, but on return the UI
    showed neither success nor failure.
    - Moves sync state (`isSyncing`, `syncError`, `syncSuccess`,
    `conflicts`, rebase status, etc.) out of local `useState` in
    `ConnectedGitHubConnector` and into a Jotai atom keyed by `appId`
    (`src/atoms/githubSyncAtoms.ts`), so it survives unmount/remount.
    - Adds success/error toasts on completion so users get feedback even
    when they're viewing a different preview tab.
    
    ## Test plan
    - [x] New unit tests in `src/atoms/githubSyncAtoms.test.tsx` verify
    state is preserved across unmount/remount, that a "completion" happening
    while unmounted is visible on remount, that state is isolated per
    `appId`, and that `null` appId is a no-op.
    - [x] `npm run ts` — clean
    - [x] `npm run fmt` / `npm run lint:fix` — clean (only the pre-existing
    unrelated warning in `local_agent_handler.test.ts`)
    - [x] `npm test` — 1003/1003 passing
    - [ ] Manual: click Sync to GitHub, immediately switch to Code tab,
    switch back — spinner should still show (if still running) or the
    success message should be visible (if finished); a toast should appear
    on completion regardless of tab.
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    <!-- devin-review-badge-begin -->
    
    ---
    
    <a href="https://app.devin.ai/review/dyad-sh/dyad/pull/3151"
    target="_blank">
      <picture>
    <source media="(prefers-color-scheme: dark)"
    srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1">
    <img
    src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1"
    alt="Open with Devin">
      </picture>
    </a>
    <!-- devin-review-badge-end -->
    
    ---------
    Co-authored-by: 's avatarWill Chen <7344640+wwwillchen@users.noreply.github.com>
    Co-authored-by: 's avatarClaude Opus 4.6 (1M context) <noreply@anthropic.com>
    7ca7b0c1
githubSyncAtoms.ts 2.0 KB