• Will Chen's avatar
    Use idiomatic react-query for useProposal (#2018) · a4747a49
    Will Chen 提交于
    <!-- CURSOR_SUMMARY -->
    > [!NOTE]
    > **Refactor: proposal fetching via react-query**
    > 
    > - Replaces Jotai state/effects with `useQuery` in `useProposal`
    (`queryKey: ["proposal", chatId]`, `enabled` gating, `refetch` exposed,
    error typed as `Error`)
    > - Deletes `src/atoms/proposalAtoms.ts`; `proposalResultAtom` removed
    > - In `useStreamChat`, stop using `useProposal`; on stream end, call
    `queryClient.invalidateQueries({ queryKey: ["proposal", chatId] })`
    > - In `ChatInput`, display `proposalError.message` and keep using
    `refreshProposal()` from the hook
    > 
    > <sup>Written by [Cursor
    Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
    9739b1befe76a7cb491594815d3d92977ad6a1c6. This will update automatically
    on new commits. Configure
    [here](https://cursor.com/dashboard?tab=bugbot).</sup>
    <!-- /CURSOR_SUMMARY -->
    
    
    
    
    
    <!-- This is an auto-generated description by cubic. -->
    ---
    ## Summary by cubic
    Refactored proposal fetching to use React Query’s useQuery, removing
    Jotai state and simplifying refresh and error handling. Improves
    reliability and makes the hook easier to use.
    
    - **Refactors**
    - Replaced custom state/effects with useQuery (key: ["proposal",
    chatId], enabled only when chatId).
    - Removed proposalAtoms and Jotai; hook now returns proposalResult,
    isLoading, error, refreshProposal.
    - Updated useStreamChat to invalidate the proposal query via QueryClient
    (invalidateQueries(["proposal", chatId])).
      - ChatInput now displays proposalError.message for clearer errors.
      - Added meta: { showErrorToast: true } to surface fetch errors.
    
    <sup>Written for commit 9739b1befe76a7cb491594815d3d92977ad6a1c6.
    Summary will update automatically on new commits.</sup>
    
    <!-- End of auto-generated description by cubic. -->
    a4747a49
名称
最后提交
最后更新
..
__tests__ 正在载入提交数据...
app 正在载入提交数据...
atoms 正在载入提交数据...
client_logic 正在载入提交数据...
components 正在载入提交数据...
constants 正在载入提交数据...
contexts 正在载入提交数据...
db 正在载入提交数据...
hooks 正在载入提交数据...
ipc 正在载入提交数据...
lib 正在载入提交数据...
main 正在载入提交数据...
neon_admin 正在载入提交数据...
pages 正在载入提交数据...
paths 正在载入提交数据...
pro 正在载入提交数据...
prompts 正在载入提交数据...
routes 正在载入提交数据...
shared 正在载入提交数据...
store 正在载入提交数据...
styles 正在载入提交数据...
supabase_admin 正在载入提交数据...
utils 正在载入提交数据...
backup_manager.ts 正在载入提交数据...
main.ts 正在载入提交数据...
preload.ts 正在载入提交数据...
renderer.tsx 正在载入提交数据...
router.ts 正在载入提交数据...