@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
14
14
limitations under the License.
15
15
*/
16
16
17
- import React , { useCallback , useContext , useEffect , useState } from "react" ;
17
+ import React , { useCallback , useContext , useEffect , useMemo , useState } from "react" ;
18
18
import classNames from "classnames" ;
19
19
import { Room } from "matrix-js-sdk/src/models/room" ;
20
20
@@ -197,6 +197,8 @@ const AppRow: React.FC<IAppRowProps> = ({ app, room }) => {
197
197
198
198
const AppsSection : React . FC < IAppsSectionProps > = ( { room } ) => {
199
199
const apps = useWidgets ( room ) ;
200
+ // Filter out virtual widgets
201
+ const realApps = useMemo ( ( ) => apps . filter ( app => app . eventId !== undefined ) , [ apps ] ) ;
200
202
201
203
const onManageIntegrations = ( ) => {
202
204
const managers = IntegrationManagers . sharedInstance ( ) ;
@@ -208,8 +210,8 @@ const AppsSection: React.FC<IAppsSectionProps> = ({ room }) => {
208
210
}
209
211
} ;
210
212
211
- let copyLayoutBtn = null ;
212
- if ( apps . length > 0 && WidgetLayoutStore . instance . canCopyLayoutToRoom ( room ) ) {
213
+ let copyLayoutBtn : JSX . Element | null = null ;
214
+ if ( realApps . length > 0 && WidgetLayoutStore . instance . canCopyLayoutToRoom ( room ) ) {
213
215
copyLayoutBtn = (
214
216
< AccessibleButton kind = "link" onClick = { ( ) => WidgetLayoutStore . instance . copyLayoutToRoom ( room ) } >
215
217
{ _t ( "Set my room layout for everyone" ) }
@@ -218,10 +220,10 @@ const AppsSection: React.FC<IAppsSectionProps> = ({ room }) => {
218
220
}
219
221
220
222
return < Group className = "mx_RoomSummaryCard_appsGroup" title = { _t ( "Widgets" ) } >
221
- { apps . map ( app => < AppRow key = { app . id } app = { app } room = { room } /> ) }
223
+ { realApps . map ( app => < AppRow key = { app . id } app = { app } room = { room } /> ) }
222
224
{ copyLayoutBtn }
223
225
< AccessibleButton kind = "link" onClick = { onManageIntegrations } >
224
- { apps . length > 0 ? _t ( "Edit widgets, bridges & bots" ) : _t ( "Add widgets, bridges & bots" ) }
226
+ { realApps . length > 0 ? _t ( "Edit widgets, bridges & bots" ) : _t ( "Add widgets, bridges & bots" ) }
225
227
</ AccessibleButton >
226
228
</ Group > ;
227
229
} ;
0 commit comments