@@ -44,7 +44,13 @@ export function WorkflowTemplateList({match, location, history}: RouteComponentP
4444 const [ namespace , setNamespace ] = useState ( nsUtils . getNamespace ( match . params . namespace ) || '' ) ;
4545 const [ sidePanel , setSidePanel ] = useState ( queryParams . get ( 'sidePanel' ) === 'true' ) ;
4646 const [ namePattern , setNamePattern ] = useState ( '' ) ;
47- const [ labels , setLabels ] = useState ( [ ] ) ;
47+ const [ labels , setLabels ] = useState < string [ ] > ( ( ) => {
48+ const savedOptions = storage . getItem ( 'options' , { } ) ;
49+ const savedLabels = savedOptions . labels || [ ] ;
50+ const labelQueryParam = queryParams . getAll ( 'label' ) ;
51+ return labelQueryParam . length > 0 ? labelQueryParam : savedLabels ;
52+ } ) ;
53+
4854 const [ pagination , setPagination ] = useState < Pagination > ( {
4955 offset : queryParams . get ( 'offset' ) ,
5056 limit : parseLimit ( queryParams . get ( 'limit' ) ) || savedOptions . paginationLimit || 500
@@ -62,14 +68,19 @@ export function WorkflowTemplateList({match, location, history}: RouteComponentP
6268 isFirstRender . current = false ;
6369 return ;
6470 }
71+ storage . setItem ( 'options' , { labels} , { } ) ;
72+ const params = new URLSearchParams ( ) ;
73+ labels ?. forEach ( label => params . append ( 'label' , label ) ) ;
74+ if ( sidePanel ) {
75+ params . append ( 'sidePanel' , 'true' ) ;
76+ }
6577 history . push (
6678 historyUrl ( 'workflow-templates' + ( nsUtils . getManagedNamespace ( ) ? '' : '/{namespace}' ) , {
6779 namespace,
68- sidePanel
80+ extraSearchParams : params
6981 } )
7082 ) ;
71- } , [ namespace , sidePanel ] ) ;
72-
83+ } , [ namespace , sidePanel , labels . toString ( ) ] ) ;
7384 // internal state
7485 const [ error , setError ] = useState < Error > ( ) ;
7586 const [ templates , setTemplates ] = useState < WorkflowTemplate [ ] > ( ) ;
0 commit comments