@@ -42,6 +42,7 @@ import {
4242 EyeOff ,
4343} from "lucide-react" ;
4444import { useMutation , useQuery , useQueryClient } from "@tanstack/react-query" ;
45+ import { logger } from "@repo/logger" ;
4546
4647interface CategorySettingsProps {
4748 category : SettingCategory ;
@@ -62,7 +63,9 @@ export function CategorySettings({
6263 ) ;
6364
6465 // State for edited values
65- const [ editedValues , setEditedValues ] = useState < Record < string , any > > ( { } ) ;
66+ const [ editedValues , setEditedValues ] = useState <
67+ Record < string , string | number | boolean | object >
68+ > ( { } ) ;
6669 const [ historyKey , setHistoryKey ] = useState < string | null > ( null ) ;
6770
6871 const byCategoryQueryKey = trpc . admin . settings . getByCategory . queryKey ( ) ;
@@ -105,7 +108,10 @@ export function CategorySettings({
105108 )
106109 ) ;
107110
108- const handleValueChange = ( key : string , value : any ) => {
111+ const handleValueChange = (
112+ key : string ,
113+ value : string | number | boolean | object
114+ ) => {
109115 setEditedValues ( ( prev ) => ( {
110116 ...prev ,
111117 [ key ] : value ,
@@ -132,7 +138,7 @@ export function CategorySettings({
132138 const key = setting . key ;
133139 const value = key in editedValues ? editedValues [ key ] : setting . value ;
134140 const type = setting . meta . type ;
135- const isEdited = key in editedValues ;
141+ // const isEdited = key in editedValues;
136142 const isSecret = setting . meta . isSecret ;
137143
138144 switch ( type ) {
@@ -208,7 +214,11 @@ export function CategorySettings({
208214 const parsed = JSON . parse ( e . target . value ) ;
209215 handleValueChange ( key , parsed ) ;
210216 } catch ( error ) {
211- // Don't update if invalid JSON
217+ if ( error instanceof Error ) {
218+ logger . error ( error . message ) ;
219+ } else {
220+ logger . error ( error as string ) ;
221+ }
212222 }
213223 } }
214224 className = "border-input bg-background-paper min-h-[100px] w-full rounded-md border px-3 py-2 text-sm"
0 commit comments