Preserve explicit DEFAULT_MODEL draft overrides
Co-authored-by: codex <[email protected]>
This commit is contained in:
1 parent
ec18318e3c
commit
123eb96c52
2 files changed
+21
-6
No files matched your search
@@ -242,3 +242,23 @@ describe("composerDraftStore project draft thread mapping", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("composerDraftStore setModel", () => {
|
||||
const threadId = ThreadId.makeUnsafe("thread-model");
|
||||
|
||||
beforeEach(() => {
|
||||
useComposerDraftStore.setState({
|
||||
draftsByThreadId: {},
|
||||
draftThreadsByThreadId: {},
|
||||
projectDraftThreadIdByProjectId: {},
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps explicit DEFAULT_MODEL overrides instead of coercing to null", () => {
|
||||
const store = useComposerDraftStore.getState();
|
||||
|
||||
store.setModel(threadId, "gpt-5.3-codex");
|
||||
|
||||
expect(useComposerDraftStore.getState().draftsByThreadId[threadId]?.model).toBe("gpt-5.3-codex");
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
DEFAULT_MODEL,
|
||||
DEFAULT_REASONING,
|
||||
ProjectId,
|
||||
REASONING_OPTIONS,
|
||||
@@ -671,11 +670,7 @@ export const useComposerDraftStore = create<ComposerDraftStoreState>()(
|
||||
if (threadId.length === 0) {
|
||||
return;
|
||||
}
|
||||
const normalizedModelCandidate = normalizeModelSlug(model);
|
||||
const normalizedModel =
|
||||
normalizedModelCandidate && normalizedModelCandidate !== DEFAULT_MODEL
|
||||
? normalizedModelCandidate
|
||||
: null;
|
||||
const normalizedModel = normalizeModelSlug(model) ?? null;
|
||||
set((state) => {
|
||||
const existing = state.draftsByThreadId[threadId];
|
||||
if (!existing && normalizedModel === null) {
|
||||
|
||||
Reference in new issue
Block a user