File tree Expand file tree Collapse file tree 3 files changed +19
-12
lines changed
Expand file tree Collapse file tree 3 files changed +19
-12
lines changed Original file line number Diff line number Diff line change @@ -458,7 +458,6 @@ type HighlightCodeProps = {
458458 preClassName ?: string ;
459459 isWrapped : boolean ;
460460 searchTerm ?: string ;
461- containerRef ?: React . RefObject < HTMLDivElement > ;
462461} ;
463462
464463function HighlightCode ( {
@@ -472,7 +471,6 @@ function HighlightCode({
472471 preClassName,
473472 isWrapped,
474473 searchTerm,
475- containerRef,
476474} : HighlightCodeProps ) {
477475 const [ isLoaded , setIsLoaded ] = useState ( false ) ;
478476
@@ -502,7 +500,7 @@ function HighlightCode({
502500
503501 if ( ! isLoaded ) {
504502 return (
505- < div dir = "ltr" className = { containerClasses } ref = { containerRef } >
503+ < div dir = "ltr" className = { containerClasses } >
506504 < pre className = { preClasses } > { code } </ pre >
507505 </ div >
508506 ) ;
@@ -517,7 +515,7 @@ function HighlightCode({
517515 getLineProps,
518516 getTokenProps,
519517 } ) => (
520- < div dir = "ltr" className = { containerClasses } ref = { containerRef } >
518+ < div dir = "ltr" className = { containerClasses } >
521519 < pre className = { cn ( preClasses , inheritedClassName ) } style = { inheritedStyle } dir = "ltr" >
522520 { tokens
523521 . map ( ( line , index ) => {
Original file line number Diff line number Diff line change @@ -204,12 +204,7 @@ export function LogsTable({
204204 { /* Infinite scroll trigger */ }
205205 { hasMore && logs . length > 0 && (
206206 < div ref = { loadMoreRef } className = "flex items-center justify-center py-12" >
207- < div
208- className = { cn (
209- "flex items-center gap-2" ,
210- ! showLoadMoreSpinner && "invisible"
211- ) }
212- >
207+ < div className = { cn ( "flex items-center gap-2" , ! showLoadMoreSpinner && "invisible" ) } >
213208 < Spinner /> < span className = "text-text-dimmed" > Loading more…</ span >
214209 </ div >
215210 </ div >
@@ -224,8 +219,9 @@ export function LogsTable({
224219 LeadingIcon = { ArrowPathIcon }
225220 variant = "tertiary/small"
226221 onClick = { onCheckForMore }
222+ disabled = { isLoadingMore }
227223 >
228- Check for new logs
224+ { isLoadingMore ? "Checking…" : " Check for new logs" }
229225 </ Button >
230226 ) }
231227 </ div >
Original file line number Diff line number Diff line change @@ -9,14 +9,27 @@ const schema = z.object({
99 timezone : z . string ( ) . min ( 1 ) . max ( 100 ) ,
1010} ) ;
1111
12+ // Cache the supported timezones to avoid repeated calls
13+ const supportedTimezones = new Set ( Intl . supportedValuesOf ( "timeZone" ) ) ;
14+
1215export async function action ( { request } : ActionFunctionArgs ) {
13- const data = await request . json ( ) ;
16+ let data : unknown ;
17+ try {
18+ data = await request . json ( ) ;
19+ } catch {
20+ return json ( { success : false , error : "Invalid JSON" } , { status : 400 } ) ;
21+ }
22+
1423 const result = schema . safeParse ( data ) ;
1524
1625 if ( ! result . success ) {
1726 return json ( { success : false , error : "Invalid timezone" } , { status : 400 } ) ;
1827 }
1928
29+ if ( ! supportedTimezones . has ( result . data . timezone ) ) {
30+ return json ( { success : false , error : "Invalid timezone" } , { status : 400 } ) ;
31+ }
32+
2033 const session = await setTimezonePreference ( result . data . timezone , request ) ;
2134
2235 return json (
You can’t perform that action at this time.
0 commit comments