@@ -24,7 +24,6 @@ export interface DesignTableProps {
2424 workspaceId : string ;
2525 isKanvasEnabled : boolean ;
2626 workspaceName : string ;
27- designsOfWorkspace : any ;
2827 meshModelModelsData : any ;
2928 useGetWorkspaceDesignsQuery : any ;
3029 useAssignDesignToWorkspaceMutation : any ;
@@ -57,7 +56,6 @@ export interface DesignTableProps {
5756 isUnpublishAllowed : boolean ;
5857 isAssignAllowed : boolean ;
5958 isRemoveAllowed : boolean ;
60- setDesignSearch : ( value : string ) => void ;
6159 handleOpenInDesigner ?: ( designId : string , designName : string ) => void ;
6260 showPlaygroundActions ?: boolean ;
6361 handleVisibilityChange ?: ( id : string , visibility : VIEW_VISIBILITY ) => void ;
@@ -78,7 +76,6 @@ export interface TableColumn {
7876const DesignTable : React . FC < DesignTableProps > = ( {
7977 workspaceId,
8078 workspaceName,
81- designsOfWorkspace,
8279 meshModelModelsData,
8380 handleBulkUnpublishModal,
8481 handleBulkWorkspaceDesignDeleteModal,
@@ -102,7 +99,6 @@ const DesignTable: React.FC<DesignTableProps> = ({
10299 isAssignAllowed,
103100 isRemoveAllowed,
104101 useGetWorkspaceDesignsQuery,
105- setDesignSearch,
106102 handleOpenInDesigner,
107103 showPlaygroundActions = true ,
108104 handleVisibilityChange,
@@ -112,12 +108,28 @@ const DesignTable: React.FC<DesignTableProps> = ({
112108 open : false ,
113109 pattern : { }
114110 } ) ;
111+
115112 const modalRef = useRef ( null ) ;
113+ const [ search , setSearch ] = useState ( '' ) ;
116114 const [ page , setPage ] = useState < number > ( 0 ) ;
117115 const [ pageSize , setPageSize ] = useState < number > ( 10 ) ;
118116 const [ sortOrder , setSortOrder ] = useState < string > ( 'updated_at desc' ) ;
119117 const [ isSearchExpanded , setIsSearchExpanded ] = useState ( false ) ;
120118
119+ const { data : designsOfWorkspace , refetch : refetchWorkspaceDesigns } =
120+ useGetWorkspaceDesignsQuery (
121+ {
122+ workspaceId,
123+ page : page ,
124+ pagesize : pageSize ,
125+ search : search ,
126+ order : sortOrder ,
127+ expandUser : true
128+ } ,
129+ {
130+ skip : ! workspaceId
131+ }
132+ ) ;
121133 const handlePublishModal = ( pattern : Pattern ) : void => {
122134 const result = publishModalHandler ( pattern ) ;
123135 setPublishModal ( {
@@ -146,7 +158,8 @@ const DesignTable: React.FC<DesignTableProps> = ({
146158 handleOpenInDesigner,
147159 showPlaygroundActions,
148160 handleVisibilityChange,
149- currentUserId
161+ currentUserId,
162+ refetchWorkspaceDesigns
150163 } ) ;
151164
152165 const [ publishSchema , setPublishSchema ] = useState < {
@@ -206,10 +219,10 @@ const DesignTable: React.FC<DesignTableProps> = ({
206219 >
207220 < SearchBar
208221 onSearch = { ( value ) => {
209- setDesignSearch ( value ) ;
222+ setSearch ( value ) ;
210223 } }
211224 onClear = { ( ) => {
212- setDesignSearch ( '' ) ;
225+ setSearch ( '' ) ;
213226 } }
214227 expanded = { isSearchExpanded }
215228 setExpanded = { setIsSearchExpanded }
@@ -252,7 +265,7 @@ const DesignTable: React.FC<DesignTableProps> = ({
252265 handleBulkWorkspaceDesignDeleteModal ( designs , modalRef , workspaceName , workspaceId )
253266 }
254267 filter = { 'my-designs' }
255- setSearch = { setDesignSearch }
268+ setSearch = { setSearch }
256269 />
257270 < AssignmentModal
258271 open = { designAssignment . assignModal }
0 commit comments