fix(chat): make Home pass react-hooks lint after the split
Independent Staging Quality Gate / validate (push) Successful in 17m39s
Independent Staging Quality Gate / publish (push) Successful in 7m11s

eslint-plugin-react-hooks now analyzes the smaller Home, so render-time ref writes and sync effect setState were failing the staging gate.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jesse_Chen
2026-09-02 07:01:36 +08:00
co-authored by Cursor
parent 124d3990b2
commit 058e5db9b5
7 changed files with 106 additions and 75 deletions
@@ -87,6 +87,8 @@ export type ProfileOnboardingParams = {
setStartGreeting: Dispatch<SetStateAction<string>>;
signingOut: boolean;
uiPreview: MutableRefObject<boolean>;
guidedBirthTimeReadyRef: MutableRefObject<(result: JourneyClientResponse) => void>;
editDeclaredBirthTimeDetailsRef: MutableRefObject<() => void>;
};
export function useProfileOnboarding(params: ProfileOnboardingParams) {
@@ -127,6 +129,8 @@ export function useProfileOnboarding(params: ProfileOnboardingParams) {
setStartGreeting,
signingOut,
uiPreview,
guidedBirthTimeReadyRef,
editDeclaredBirthTimeDetailsRef,
} = params;
async function refreshAccount() {
@@ -405,6 +409,9 @@ export function useProfileOnboarding(params: ProfileOnboardingParams) {
}
}
guidedBirthTimeReadyRef.current = completeGuidedBirthTime;
editDeclaredBirthTimeDetailsRef.current = editDeclaredBirthTimeDetails;
return {
refreshAccount,
openAccountDialog,
@@ -64,6 +64,7 @@ export type RectificationSurfaceParams = {
updateSession: (sessionId: string, change: (session: ChatSession) => ChatSession) => void;
openAccountDialog: (dialog: AccountDialog, returnTarget?: HTMLButtonElement | null) => void;
refreshAccount: () => Promise<void>;
rectificationSessionOpenerRef: MutableRefObject<(exactSessionId: string) => Promise<void>>;
};
export function useRectificationSurface(params: RectificationSurfaceParams) {
@@ -103,6 +104,7 @@ export function useRectificationSurface(params: RectificationSurfaceParams) {
updateSession,
openAccountDialog,
refreshAccount,
rectificationSessionOpenerRef,
} = params;
async function refreshRectificationEntrySummary() {
@@ -267,6 +269,7 @@ export function useRectificationSurface(params: RectificationSurfaceParams) {
sessionSelectionSource.current = "history";
void openRectificationSession(session.id);
};
rectificationSessionOpenerRef.current = openRectificationSession;
function handleRectificationProfileIncomplete() {
setRectificationError("profile_incomplete");
@@ -117,6 +117,7 @@ export function useSessionManagement(params: SessionManagementParams) {
visibleSessions,
openRectificationSession,
} = params;
sessionsRef.current = sessions;
function updateSession(sessionId: string, change: (session: ChatSession) => ChatSession) {
setSessions((current) => current.map((session) => (session.id === sessionId ? change(session) : session)));