Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

Merge remote-tracking branch 'origin/main' into feature/rx-202

Amruth Pillai2681ab827d4f
diff --cc apps/mobile/src/features/workspace/tabs/apply.tsx
index 53ab35137,2bd5be92f..589794c7d
--- a/apps/mobile/src/features/workspace/tabs/apply.tsx
+++ b/apps/mobile/src/features/workspace/tabs/apply.tsx
@@@ -341,25 -309,21 +342,26 @@@ function AnswerCard(
text: string;
factIds: string[];
note?: string | null;
- before: { text: string; factIds: string[] };
+ aiOperationIds?: string[] | undefined;
+ before: { text: string; factIds: string[]; aiOperationIds: string[] };
} | null>(null);
// The answer as it reads now, for a toast's Undo that runs after later renders.
- const current = useRef({ text, question, factIds: answer.factIds });
- const current = useRef({ text, factIds: answer.factIds, aiOperationIds: answer.aiOperationIds ?? [] });
++ const current = useRef({ text, question, factIds: answer.factIds, aiOperationIds: answer.aiOperationIds ?? [] });
useLayoutEffect(() => {
- current.current = { text, question, factIds: answer.factIds };
- current.current = { text, factIds: answer.factIds, aiOperationIds: answer.aiOperationIds ?? [] };
++ current.current = { text, question, factIds: answer.factIds, aiOperationIds: answer.aiOperationIds ?? [] };
});
- const previousSaved = useRef(answer.answer);
+ const previousSaved = useRef({ text: answer.answer, question: answer.question });
useLayoutEffect(() => {
// A refetch is not a local edit to autosave. Keep only text the user changed since the last saved copy.
- if (previousSaved.current !== answer.answer && current.current.text === previousSaved.current)
+ if (previousSaved.current.text !== answer.answer && current.current.text === previousSaved.current.text)
setText(answer.answer);
- previousSaved.current = answer.answer;
- }, [answer.answer, setText]);
+ if (
+ previousSaved.current.question !== answer.question &&
+ current.current.question === previousSaved.current.question
+ )
+ setQuestion(answer.question);
+ previousSaved.current = { text: answer.answer, question: answer.question };
+ }, [answer.answer, answer.question, setText, setQuestion]);
const generate = useGenerate(applicationId);
const provider = useHasAIProvider().defaultProvider;
const answerSave = useAutosave(
diff --cc apps/mobile/src/features/workspace/tabs/saved.tsx
index 54a302b3c,87cbac70b..25f3ccec8
--- a/apps/mobile/src/features/workspace/tabs/saved.tsx
+++ b/apps/mobile/src/features/workspace/tabs/saved.tsx
@@@ -12,7 -12,8 +12,8 @@@ import { Pressable, View } from "react-
import { useFacts, useSavedItems } from "../hooks";
import { Actions, Block, tabLabel } from "../parts";
import { WorkspaceScreen } from "../shell";
-import { client, prepareRpc } from "@/api/client";
+import { client, orpc, prepareRpc } from "@/api/client";
+ import { AiResultUsage } from "@/features/ai/usage";
import { useUserTime } from "@/features/application-detail/hooks";
import { useUndoRows } from "@/features/career/hooks";
import { formatMoney } from "@/features/career/offer-compare";
diff --cc apps/web/src/features/career/workspace/apply.tsx
index fb413f242,1f953d38e..50c9c69a8
--- a/apps/web/src/features/career/workspace/apply.tsx
+++ b/apps/web/src/features/career/workspace/apply.tsx
@@@ -45,13 -45,11 +45,13 @@@ import { AiNotice } from "./fit"
import { Preparation } from "./preparation";
import { SentDocuments } from "@/features/applications/components/detail/sent-documents";
import { useInvalidateApplications } from "@/features/applications/use-application-actions";
+import { getAccountGeneration } from "@/libs/auth/account-scope";
import { toastError } from "@/libs/error-message";
-import { orpc } from "@/libs/orpc/client";
+import { client, orpc, prepareRpc } from "@/libs/orpc/client";
+import { invalidateMutationQueries } from "@/libs/query/client";
type Answer = CareerWorkspace["answers"][number];
- type AnswerSnapshot = Pick<Answer, "answer" | "factIds">;
+ type AnswerSnapshot = Pick<Answer, "answer" | "factIds" | "aiOperationIds">;
type CountUnit = "words" | "characters";
const countWords = (text: string) => text.split(/\s+/).filter(Boolean).length;
@@@ -399,25 -356,21 +400,26 @@@ function AnswerCard(
text: string;
factIds: string[];
note?: string | null;
- before: { text: string; factIds: string[] };
+ aiOperationIds?: string[] | undefined;
+ before: { text: string; factIds: string[]; aiOperationIds: string[] };
} | null>(null);
// The answer as it reads now, for a toast's Undo that runs after later renders.
- const current = useRef({ text, question, factIds: answer.factIds });
- const current = useRef({ text, factIds: answer.factIds, aiOperationIds: answer.aiOperationIds ?? [] });
++ const current = useRef({ text, question, factIds: answer.factIds, aiOperationIds: answer.aiOperationIds ?? [] });
useLayoutEffect(() => {
- current.current = { text, question, factIds: answer.factIds };
- current.current = { text, factIds: answer.factIds, aiOperationIds: answer.aiOperationIds ?? [] };
++ current.current = { text, question, factIds: answer.factIds, aiOperationIds: answer.aiOperationIds ?? [] };
});
- const previousSaved = useRef(answer.answer);
+ const previousSaved = useRef({ text: answer.answer, question: answer.question });
useLayoutEffect(() => {
// A refetch is not a local edit to autosave. Keep only text the user changed since the last saved copy.
- if (previousSaved.current !== answer.answer && current.current.text === previousSaved.current)
+ if (previousSaved.current.text !== answer.answer && current.current.text === previousSaved.current.text)
setText(answer.answer);
- previousSaved.current = answer.answer;
- }, [answer.answer, setText]);
+ if (
+ previousSaved.current.question !== answer.question &&
+ current.current.question === previousSaved.current.question
+ )
+ setQuestion(answer.question);
+ previousSaved.current = { text: answer.answer, question: answer.question };
+ }, [answer.answer, answer.question, setText, setQuestion]);
const generate = useGenerate(applicationId);
const { provider } = useDefaultProvider();
const flushAnswer = useDebouncedSave(