File tree Expand file tree Collapse file tree 5 files changed +35
-18
lines changed Expand file tree Collapse file tree 5 files changed +35
-18
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ export default function ContainerToggleComponent(p: { children: React.ReactNode
19
19
}
20
20
21
21
return (
22
- < div className = { classes ( fluid ? "container-fluid" : "container" , "mt-3" , "d-flex " ) } >
22
+ < div className = { classes ( fluid ? "container-fluid" : "container" , "mt-3" , "sf-page-container " ) } >
23
23
< a className = "expand-window d-none d-md-block" onClick = { handleExpandToggle } href = "#" >
24
24
< FontAwesomeIcon icon = { fluid ? "compress" : "expand" } />
25
25
</ a >
Original file line number Diff line number Diff line change @@ -178,7 +178,7 @@ export default function FramePage(p: FramePageProps) {
178
178
const embeddedWidgets = renderEmbeddedWidgets ( wc ) ;
179
179
180
180
return (
181
- < div className = "normal-control flex-grow-1 " >
181
+ < div className = "normal-control" >
182
182
{ renderTitle ( ) }
183
183
{ renderWidgets ( wc ) }
184
184
{ entityComponent . current && < ButtonBar ref = { buttonBar } frame = { frame } pack = { state . pack } /> }
Original file line number Diff line number Diff line change @@ -174,3 +174,12 @@ a.expand-window:hover {
174
174
.card .card-xs .card-body {
175
175
padding : 0.3em 0.5em ;
176
176
}
177
+
178
+
179
+ .sf-page-container {
180
+ display : flex;
181
+ }
182
+
183
+ .sf-page-container > div {
184
+ flex-grow : 1 ;
185
+ }
Original file line number Diff line number Diff line change @@ -209,32 +209,40 @@ export function useMounted() {
209
209
return mounted ;
210
210
}
211
211
212
- export function useThrottle < T > ( value : T , limit : number ) : T {
212
+ export function useThrottle < T > ( value : T , limit : number , options ?: { enabled ?: boolean } ) : T {
213
213
const [ throttledValue , setThrottledValue ] = React . useState ( value ) ;
214
214
215
- const mounted = React . useRef ( true ) ;
216
215
const lastRequested = React . useRef < ( undefined | { value : T } ) > ( undefined ) ;
216
+ const handleRef = React . useRef < number | undefined > ( undefined ) ;
217
+
218
+ function stop ( ) {
219
+ if ( handleRef . current )
220
+ clearTimeout ( handleRef . current ) ;
221
+
222
+ lastRequested . current = undefined ;
223
+ }
224
+
217
225
React . useEffect (
218
226
( ) => {
219
- if ( lastRequested . current ) {
220
- lastRequested . current . value = value ;
227
+ if ( options && options . enabled == false ) {
228
+ stop ( ) ;
221
229
} else {
222
- lastRequested . current = { value } ;
223
- const handler = setTimeout ( function ( ) {
224
- if ( mounted . current ) {
230
+ if ( lastRequested . current ) {
231
+ lastRequested . current . value = value ;
232
+ } else {
233
+ lastRequested . current = { value } ;
234
+ handleRef . current = setTimeout ( function ( ) {
225
235
setThrottledValue ( lastRequested . current ! . value ) ;
226
- lastRequested . current = undefined ;
227
-
228
- clearTimeout ( handler ) ;
229
- }
230
- } , limit ) ;
236
+ stop ( ) ;
237
+ } , limit ) ;
238
+ }
231
239
}
232
240
} ,
233
- [ value , limit ]
241
+ [ value , options && options . enabled ]
234
242
) ;
235
243
236
244
React . useEffect ( ( ) => {
237
- return ( ) => { mounted . current = false ; }
245
+ return ( ) => stop ( ) ;
238
246
} , [ ] ) ;
239
247
240
248
return throttledValue ;
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ function SearchPage(p: SearchPageProps) {
56
56
57
57
if ( ! Finder . isFindable ( fo . queryName , true ) )
58
58
return (
59
- < div id = "divSearchPage" className = "flex-grow-1" >
59
+ < div id = "divSearchPage" >
60
60
< h3 >
61
61
< span className = "display-6 sf-query-title" > { getQueryNiceName ( fo . queryName ) } </ span >
62
62
< small > Error: Query not allowed { Finder . isFindable ( fo . queryName , false ) ? "in full screen" : "" } </ small >
@@ -66,7 +66,7 @@ function SearchPage(p: SearchPageProps) {
66
66
67
67
var qs = Finder . getSettings ( fo . queryName ) ;
68
68
return (
69
- < div id = "divSearchPage" className = "flex-grow-1" >
69
+ < div id = "divSearchPage" >
70
70
< h3 className = "display-6 sf-query-title" >
71
71
< span > { getQueryNiceName ( fo . queryName ) } </ span >
72
72
You can’t perform that action at this time.
0 commit comments