@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414limitations under the License.
1515*/
1616
17- import React , { useCallback , useContext , useEffect , useState } from "react" ;
17+ import React , { useCallback , useContext , useEffect , useMemo , useState } from "react" ;
1818import classNames from "classnames" ;
1919import { Room } from "matrix-js-sdk/src/models/room" ;
2020
@@ -197,6 +197,8 @@ const AppRow: React.FC<IAppRowProps> = ({ app, room }) => {
197197
198198const AppsSection : React . FC < IAppsSectionProps > = ( { room } ) => {
199199 const apps = useWidgets ( room ) ;
200+ // Filter out virtual widgets
201+ const realApps = useMemo ( ( ) => apps . filter ( app => app . eventId !== undefined ) , [ apps ] ) ;
200202
201203 const onManageIntegrations = ( ) => {
202204 const managers = IntegrationManagers . sharedInstance ( ) ;
@@ -208,8 +210,8 @@ const AppsSection: React.FC<IAppsSectionProps> = ({ room }) => {
208210 }
209211 } ;
210212
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 ) ) {
213215 copyLayoutBtn = (
214216 < AccessibleButton kind = "link" onClick = { ( ) => WidgetLayoutStore . instance . copyLayoutToRoom ( room ) } >
215217 { _t ( "Set my room layout for everyone" ) }
@@ -218,10 +220,10 @@ const AppsSection: React.FC<IAppsSectionProps> = ({ room }) => {
218220 }
219221
220222 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 } /> ) }
222224 { copyLayoutBtn }
223225 < 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" ) }
225227 </ AccessibleButton >
226228 </ Group > ;
227229} ;
0 commit comments