Skip to content

Commit ac067ec

Browse files
OptimusPiclaude
andcommitted
fix(jamlSearchContext): expose selectedFilterKey/customJamlText state
The context was declaring JamlSearchState with only jamlText/setJamlText, but JamlView.tsx and navbar.tsx both destructure selectedFilterKey, setSelectedFilterKey, customJamlText, and setCustomJamlText from useJamlSearch(). Since those weren't provided, destructuring returned undefined and calling setSelectedFilterKey(value) from the dropdown threw "is not a function" silently, leaving the editor text frozen. Added selectedFilterKey + setSelectedFilterKey + customJamlText + setCustomJamlText to the context. Dropdown now updates. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent d31b4e9 commit ac067ec

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/modules/state/jamlSearchContext.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@ interface JamlSearchState {
66
funnyMode: 'palindrome' | 'keyword';
77
funnyKeywords: Array<string>;
88
jamlText: string;
9+
selectedFilterKey: string;
10+
customJamlText: string;
911
}
1012

1113
interface JamlSearchContextType extends JamlSearchState {
1214
setSearchMode: (mode: 'quick' | 'funny') => void;
1315
setFunnyMode: (mode: 'palindrome' | 'keyword') => void;
1416
setFunnyKeywords: (keywords: Array<string>) => void;
1517
setJamlText: (text: string) => void;
18+
setSelectedFilterKey: (key: string) => void;
19+
setCustomJamlText: (text: string) => void;
1620
}
1721

1822
const JamlSearchContext = createContext<JamlSearchContextType | undefined>(undefined);
@@ -52,11 +56,13 @@ export function JamlSearchProvider({ children }: { children: ReactNode }) {
5256
const [funnyMode, setFunnyMode] = useState<'palindrome' | 'keyword'>('palindrome');
5357
const [funnyKeywords, setFunnyKeywords] = useState<Array<string>>(['']);
5458
const [jamlText, setJamlText] = useState<string>(DEFAULT_JAML);
59+
const [selectedFilterKey, setSelectedFilterKey] = useState<string>('default');
60+
const [customJamlText, setCustomJamlText] = useState<string>('');
5561

5662
return (
5763
<JamlSearchContext.Provider value={{
58-
searchMode, funnyMode, funnyKeywords, jamlText,
59-
setSearchMode, setFunnyMode, setFunnyKeywords, setJamlText,
64+
searchMode, funnyMode, funnyKeywords, jamlText, selectedFilterKey, customJamlText,
65+
setSearchMode, setFunnyMode, setFunnyKeywords, setJamlText, setSelectedFilterKey, setCustomJamlText,
6066
}}>
6167
{children}
6268
</JamlSearchContext.Provider>

0 commit comments

Comments
 (0)