only update playlist editor when open

This commit is contained in:
dank074 2023-02-01 14:22:39 -06:00
parent 350e72b8d7
commit aba4ddf2db

View File

@ -81,8 +81,10 @@ const useFurniturePlaylistEditorWidgetState = () =>
simpleAlert(LocalizeText('playlist.editor.alert.playlist.full'), NotificationAlertType.ALERT, '', '', LocalizeText('playlist.editor.alert.playlist.full.title')); simpleAlert(LocalizeText('playlist.editor.alert.playlist.full'), NotificationAlertType.ALERT, '', '', LocalizeText('playlist.editor.alert.playlist.full.title'));
}); });
const onFurniListUpdated = useCallback((event : IMessageEvent) => const onFurniListUpdated = (event : IMessageEvent) =>
{ {
if(objectId === -1) return;
if(event instanceof FurnitureListEvent) if(event instanceof FurnitureListEvent)
{ {
if(event.getParser().fragmentNumber === 0) if(event.getParser().fragmentNumber === 0)
@ -94,7 +96,7 @@ const useFurniturePlaylistEditorWidgetState = () =>
{ {
GetNitroInstance().soundManager.musicController?.requestUserSongDisks(); GetNitroInstance().soundManager.musicController?.requestUserSongDisks();
} }
}, []); }
useMessageEvent(FurnitureListEvent, onFurniListUpdated); useMessageEvent(FurnitureListEvent, onFurniListUpdated);
useMessageEvent(FurnitureListRemovedEvent, onFurniListUpdated); useMessageEvent(FurnitureListRemovedEvent, onFurniListUpdated);