diff --git a/ErsatzTV.Application/Maintenance/Commands/EmptyTrashHandler.cs b/ErsatzTV.Application/Maintenance/Commands/EmptyTrashHandler.cs index f7077f7b9..512d81ff5 100644 --- a/ErsatzTV.Application/Maintenance/Commands/EmptyTrashHandler.cs +++ b/ErsatzTV.Application/Maintenance/Commands/EmptyTrashHandler.cs @@ -1,4 +1,5 @@ -using ErsatzTV.Core; +using Bugsnag; +using ErsatzTV.Core; using ErsatzTV.Core.Interfaces.Repositories; using ErsatzTV.Core.Interfaces.Search; using ErsatzTV.Core.Search; @@ -8,13 +9,16 @@ namespace ErsatzTV.Application.Maintenance; public class EmptyTrashHandler : IRequestHandler> { + private readonly IClient _client; private readonly IMediaItemRepository _mediaItemRepository; private readonly ISearchIndex _searchIndex; public EmptyTrashHandler( + IClient client, IMediaItemRepository mediaItemRepository, ISearchIndex searchIndex) { + _client = client; _mediaItemRepository = mediaItemRepository; _searchIndex = searchIndex; } @@ -39,7 +43,7 @@ public class EmptyTrashHandler : IRequestHandler i.Id)); } diff --git a/ErsatzTV.Application/Search/Queries/QuerySearchIndexAllItemsHandler.cs b/ErsatzTV.Application/Search/Queries/QuerySearchIndexAllItemsHandler.cs index 8349dd784..66af1c066 100644 --- a/ErsatzTV.Application/Search/Queries/QuerySearchIndexAllItemsHandler.cs +++ b/ErsatzTV.Application/Search/Queries/QuerySearchIndexAllItemsHandler.cs @@ -1,29 +1,33 @@ -using ErsatzTV.Core.Interfaces.Search; +using Bugsnag; +using ErsatzTV.Core.Interfaces.Search; using ErsatzTV.Infrastructure.Search; namespace ErsatzTV.Application.Search; -public class - QuerySearchIndexAllItemsHandler : IRequestHandler +public class QuerySearchIndexAllItemsHandler : IRequestHandler { + private readonly IClient _client; private readonly ISearchIndex _searchIndex; - public QuerySearchIndexAllItemsHandler(ISearchIndex searchIndex) => _searchIndex = searchIndex; + public QuerySearchIndexAllItemsHandler(IClient client, ISearchIndex searchIndex) + { + _client = client; + _searchIndex = searchIndex; + } - public async Task Handle( + public Task Handle( QuerySearchIndexAllItems request, CancellationToken cancellationToken) => - new( - await GetIds(SearchIndex.MovieType, request.Query), - await GetIds(SearchIndex.ShowType, request.Query), - await GetIds(SearchIndex.SeasonType, request.Query), - await GetIds(SearchIndex.EpisodeType, request.Query), - await GetIds(SearchIndex.ArtistType, request.Query), - await GetIds(SearchIndex.MusicVideoType, request.Query), - await GetIds(SearchIndex.OtherVideoType, request.Query), - await GetIds(SearchIndex.SongType, request.Query)); + new SearchResultAllItemsViewModel( + GetIds(SearchIndex.MovieType, request.Query), + GetIds(SearchIndex.ShowType, request.Query), + GetIds(SearchIndex.SeasonType, request.Query), + GetIds(SearchIndex.EpisodeType, request.Query), + GetIds(SearchIndex.ArtistType, request.Query), + GetIds(SearchIndex.MusicVideoType, request.Query), + GetIds(SearchIndex.OtherVideoType, request.Query), + GetIds(SearchIndex.SongType, request.Query)).AsTask(); - private Task> GetIds(string type, string query) => - _searchIndex.Search($"type:{type} AND ({query})", 0, 0) - .Map(result => result.Items.Map(i => i.Id).ToList()); + private List GetIds(string type, string query) => + _searchIndex.Search(_client, $"type:{type} AND ({query})", 0, 0).Items.Map(i => i.Id).ToList(); } diff --git a/ErsatzTV.Application/Search/Queries/QuerySearchIndexArtistsHandler.cs b/ErsatzTV.Application/Search/Queries/QuerySearchIndexArtistsHandler.cs index cd18255ec..d2a818c0e 100644 --- a/ErsatzTV.Application/Search/Queries/QuerySearchIndexArtistsHandler.cs +++ b/ErsatzTV.Application/Search/Queries/QuerySearchIndexArtistsHandler.cs @@ -1,4 +1,5 @@ -using ErsatzTV.Application.MediaCards; +using Bugsnag; +using ErsatzTV.Application.MediaCards; using ErsatzTV.Core.Interfaces.Repositories; using ErsatzTV.Core.Interfaces.Search; using ErsatzTV.Core.Search; @@ -6,15 +7,15 @@ using static ErsatzTV.Application.MediaCards.Mapper; namespace ErsatzTV.Application.Search; -public class - QuerySearchIndexArtistsHandler : IRequestHandler +public class QuerySearchIndexArtistsHandler : IRequestHandler { private readonly IArtistRepository _artistRepository; + private readonly IClient _client; private readonly ISearchIndex _searchIndex; - public QuerySearchIndexArtistsHandler(ISearchIndex searchIndex, IArtistRepository artistRepository) + public QuerySearchIndexArtistsHandler(IClient client, ISearchIndex searchIndex, IArtistRepository artistRepository) { + _client = client; _searchIndex = searchIndex; _artistRepository = artistRepository; } @@ -23,7 +24,8 @@ public class QuerySearchIndexArtists request, CancellationToken cancellationToken) { - SearchResult searchResult = await _searchIndex.Search( + SearchResult searchResult = _searchIndex.Search( + _client, request.Query, (request.PageNumber - 1) * request.PageSize, request.PageSize); diff --git a/ErsatzTV.Application/Search/Queries/QuerySearchIndexEpisodesHandler.cs b/ErsatzTV.Application/Search/Queries/QuerySearchIndexEpisodesHandler.cs index 25e105206..3fdade4dc 100644 --- a/ErsatzTV.Application/Search/Queries/QuerySearchIndexEpisodesHandler.cs +++ b/ErsatzTV.Application/Search/Queries/QuerySearchIndexEpisodesHandler.cs @@ -1,4 +1,5 @@ -using ErsatzTV.Application.MediaCards; +using Bugsnag; +using ErsatzTV.Application.MediaCards; using ErsatzTV.Core.Domain; using ErsatzTV.Core.Extensions; using ErsatzTV.Core.Interfaces.Emby; @@ -24,10 +25,12 @@ public class private readonly IJellyfinPathReplacementService _jellyfinPathReplacementService; private readonly IMediaSourceRepository _mediaSourceRepository; private readonly IPlexPathReplacementService _plexPathReplacementService; + private readonly IClient _client; private readonly ISearchIndex _searchIndex; private readonly ITelevisionRepository _televisionRepository; public QuerySearchIndexEpisodesHandler( + IClient client, ISearchIndex searchIndex, ITelevisionRepository televisionRepository, IMediaSourceRepository mediaSourceRepository, @@ -37,6 +40,7 @@ public class IFallbackMetadataProvider fallbackMetadataProvider, IDbContextFactory dbContextFactory) { + _client = client; _searchIndex = searchIndex; _televisionRepository = televisionRepository; _mediaSourceRepository = mediaSourceRepository; @@ -51,7 +55,8 @@ public class QuerySearchIndexEpisodes request, CancellationToken cancellationToken) { - SearchResult searchResult = await _searchIndex.Search( + SearchResult searchResult = _searchIndex.Search( + _client, request.Query, (request.PageNumber - 1) * request.PageSize, request.PageSize); diff --git a/ErsatzTV.Application/Search/Queries/QuerySearchIndexMoviesHandler.cs b/ErsatzTV.Application/Search/Queries/QuerySearchIndexMoviesHandler.cs index 6d8be69e0..917985b49 100644 --- a/ErsatzTV.Application/Search/Queries/QuerySearchIndexMoviesHandler.cs +++ b/ErsatzTV.Application/Search/Queries/QuerySearchIndexMoviesHandler.cs @@ -1,4 +1,5 @@ -using ErsatzTV.Application.MediaCards; +using Bugsnag; +using ErsatzTV.Application.MediaCards; using ErsatzTV.Core.Domain; using ErsatzTV.Core.Interfaces.Repositories; using ErsatzTV.Core.Interfaces.Search; @@ -11,13 +12,16 @@ public class QuerySearchIndexMoviesHandler : IRequestHandler { private readonly IOtherVideoRepository _otherVideoRepository; + private readonly IClient _client; private readonly ISearchIndex _searchIndex; - public QuerySearchIndexOtherVideosHandler(ISearchIndex searchIndex, IOtherVideoRepository otherVideoRepository) + public QuerySearchIndexOtherVideosHandler( + IClient client, + ISearchIndex searchIndex, + IOtherVideoRepository otherVideoRepository) { + _client = client; _searchIndex = searchIndex; _otherVideoRepository = otherVideoRepository; } @@ -23,7 +29,8 @@ public class QuerySearchIndexOtherVideos request, CancellationToken cancellationToken) { - SearchResult searchResult = await _searchIndex.Search( + SearchResult searchResult = _searchIndex.Search( + _client, request.Query, (request.PageNumber - 1) * request.PageSize, request.PageSize); diff --git a/ErsatzTV.Application/Search/Queries/QuerySearchIndexSeasonsHandler.cs b/ErsatzTV.Application/Search/Queries/QuerySearchIndexSeasonsHandler.cs index 744348463..45f6ee5f6 100644 --- a/ErsatzTV.Application/Search/Queries/QuerySearchIndexSeasonsHandler.cs +++ b/ErsatzTV.Application/Search/Queries/QuerySearchIndexSeasonsHandler.cs @@ -1,4 +1,5 @@ -using ErsatzTV.Application.MediaCards; +using Bugsnag; +using ErsatzTV.Application.MediaCards; using ErsatzTV.Core.Domain; using ErsatzTV.Core.Interfaces.Repositories; using ErsatzTV.Core.Interfaces.Search; @@ -11,14 +12,17 @@ public class QuerySearchIndexSeasonsHandler : IRequestHandler { private readonly IMediaSourceRepository _mediaSourceRepository; + private readonly IClient _client; private readonly ISearchIndex _searchIndex; private readonly ITelevisionRepository _televisionRepository; public QuerySearchIndexSeasonsHandler( + IClient client, ISearchIndex searchIndex, ITelevisionRepository televisionRepository, IMediaSourceRepository mediaSourceRepository) { + _client = client; _searchIndex = searchIndex; _televisionRepository = televisionRepository; _mediaSourceRepository = mediaSourceRepository; @@ -28,7 +32,8 @@ public class QuerySearchIndexSeasons request, CancellationToken cancellationToken) { - SearchResult searchResult = await _searchIndex.Search( + SearchResult searchResult = _searchIndex.Search( + _client, request.Query, (request.PageNumber - 1) * request.PageSize, request.PageSize); diff --git a/ErsatzTV.Application/Search/Queries/QuerySearchIndexShowsHandler.cs b/ErsatzTV.Application/Search/Queries/QuerySearchIndexShowsHandler.cs index b0324200c..498dd5aa9 100644 --- a/ErsatzTV.Application/Search/Queries/QuerySearchIndexShowsHandler.cs +++ b/ErsatzTV.Application/Search/Queries/QuerySearchIndexShowsHandler.cs @@ -1,4 +1,5 @@ -using ErsatzTV.Application.MediaCards; +using Bugsnag; +using ErsatzTV.Application.MediaCards; using ErsatzTV.Core.Domain; using ErsatzTV.Core.Interfaces.Repositories; using ErsatzTV.Core.Interfaces.Search; @@ -11,14 +12,17 @@ public class QuerySearchIndexShowsHandler : IRequestHandler { private readonly IMediaSourceRepository _mediaSourceRepository; + private readonly IClient _client; private readonly ISearchIndex _searchIndex; private readonly ITelevisionRepository _televisionRepository; public QuerySearchIndexShowsHandler( + IClient client, ISearchIndex searchIndex, ITelevisionRepository televisionRepository, IMediaSourceRepository mediaSourceRepository) { + _client = client; _searchIndex = searchIndex; _televisionRepository = televisionRepository; _mediaSourceRepository = mediaSourceRepository; @@ -28,7 +32,8 @@ public class QuerySearchIndexShows request, CancellationToken cancellationToken) { - SearchResult searchResult = await _searchIndex.Search( + SearchResult searchResult = _searchIndex.Search( + _client, request.Query, (request.PageNumber - 1) * request.PageSize, request.PageSize); diff --git a/ErsatzTV.Application/Search/Queries/QuerySearchIndexSongsHandler.cs b/ErsatzTV.Application/Search/Queries/QuerySearchIndexSongsHandler.cs index 1038d18b3..8c570fd16 100644 --- a/ErsatzTV.Application/Search/Queries/QuerySearchIndexSongsHandler.cs +++ b/ErsatzTV.Application/Search/Queries/QuerySearchIndexSongsHandler.cs @@ -1,4 +1,5 @@ -using ErsatzTV.Application.MediaCards; +using Bugsnag; +using ErsatzTV.Application.MediaCards; using ErsatzTV.Core.Interfaces.Repositories; using ErsatzTV.Core.Interfaces.Search; using ErsatzTV.Core.Search; @@ -6,15 +7,15 @@ using static ErsatzTV.Application.MediaCards.Mapper; namespace ErsatzTV.Application.Search; -public class - QuerySearchIndexSongsHandler : IRequestHandler +public class QuerySearchIndexSongsHandler : IRequestHandler { + private readonly IClient _client; private readonly ISearchIndex _searchIndex; private readonly ISongRepository _songRepository; - public QuerySearchIndexSongsHandler(ISearchIndex searchIndex, ISongRepository songRepository) + public QuerySearchIndexSongsHandler(IClient client, ISearchIndex searchIndex, ISongRepository songRepository) { + _client = client; _searchIndex = searchIndex; _songRepository = songRepository; } @@ -23,7 +24,8 @@ public class QuerySearchIndexSongs request, CancellationToken cancellationToken) { - SearchResult searchResult = await _searchIndex.Search( + SearchResult searchResult = _searchIndex.Search( + _client, request.Query, (request.PageNumber - 1) * request.PageSize, request.PageSize); diff --git a/ErsatzTV.Core.Tests/Scheduling/ScheduleIntegrationTests.cs b/ErsatzTV.Core.Tests/Scheduling/ScheduleIntegrationTests.cs index 8c1334632..6fd9ea715 100644 --- a/ErsatzTV.Core.Tests/Scheduling/ScheduleIntegrationTests.cs +++ b/ErsatzTV.Core.Tests/Scheduling/ScheduleIntegrationTests.cs @@ -1,3 +1,4 @@ +using Bugsnag; using Dapper; using Destructurama; using ErsatzTV.Core.Domain; @@ -152,7 +153,7 @@ public class ScheduleIntegrationTests var builder = new PlayoutBuilder( new ConfigElementRepository(factory), - new MediaCollectionRepository(new Mock().Object, factory), + new MediaCollectionRepository(new Mock().Object, new Mock().Object, factory), new TelevisionRepository(factory), new ArtistRepository(factory), new Mock().Object, diff --git a/ErsatzTV.Core/Interfaces/Search/ISearchIndex.cs b/ErsatzTV.Core/Interfaces/Search/ISearchIndex.cs index 9b76fdd32..9f997d1c0 100644 --- a/ErsatzTV.Core/Interfaces/Search/ISearchIndex.cs +++ b/ErsatzTV.Core/Interfaces/Search/ISearchIndex.cs @@ -1,4 +1,5 @@ -using ErsatzTV.Core.Domain; +using Bugsnag; +using ErsatzTV.Core.Domain; using ErsatzTV.Core.Interfaces.Metadata; using ErsatzTV.Core.Interfaces.Repositories; using ErsatzTV.Core.Interfaces.Repositories.Caching; @@ -23,6 +24,6 @@ public interface ISearchIndex : IDisposable List items); Task RemoveItems(List ids); - Task Search(string query, int skip, int limit, string searchField = ""); + SearchResult Search(IClient client, string query, int skip, int limit, string searchField = ""); void Commit(); } diff --git a/ErsatzTV.Infrastructure/Data/Repositories/MediaCollectionRepository.cs b/ErsatzTV.Infrastructure/Data/Repositories/MediaCollectionRepository.cs index 2b54fb973..26be4fd40 100644 --- a/ErsatzTV.Infrastructure/Data/Repositories/MediaCollectionRepository.cs +++ b/ErsatzTV.Infrastructure/Data/Repositories/MediaCollectionRepository.cs @@ -1,4 +1,5 @@ -using Dapper; +using Bugsnag; +using Dapper; using ErsatzTV.Core.Domain; using ErsatzTV.Core.Interfaces.Repositories; using ErsatzTV.Core.Interfaces.Search; @@ -13,12 +14,15 @@ namespace ErsatzTV.Infrastructure.Data.Repositories; public class MediaCollectionRepository : IMediaCollectionRepository { private readonly IDbContextFactory _dbContextFactory; + private readonly IClient _client; private readonly ISearchIndex _searchIndex; public MediaCollectionRepository( + IClient client, ISearchIndex searchIndex, IDbContextFactory dbContextFactory) { + _client = client; _searchIndex = searchIndex; _dbContextFactory = dbContextFactory; } @@ -96,7 +100,7 @@ public class MediaCollectionRepository : IMediaCollectionRepository foreach (SmartCollection collection in maybeCollection) { - SearchResult searchResults = await _searchIndex.Search(collection.Query, 0, 0); + SearchResult searchResults = _searchIndex.Search(_client, collection.Query, 0, 0); var movieIds = searchResults.Items .Filter(i => i.Type == SearchIndex.MovieType) diff --git a/ErsatzTV.Infrastructure/Plex/PlexServerApiClient.cs b/ErsatzTV.Infrastructure/Plex/PlexServerApiClient.cs index 272d21ed4..d8009ffa2 100644 --- a/ErsatzTV.Infrastructure/Plex/PlexServerApiClient.cs +++ b/ErsatzTV.Infrastructure/Plex/PlexServerApiClient.cs @@ -103,7 +103,7 @@ public class PlexServerApiClient : IPlexServerApiClient { return jsonService .GetLibrarySectionContents(library.Key, skip, pageSize, token.AuthToken) - .Map(r => r.MediaContainer.Metadata) + .Map(r => r.MediaContainer.Metadata ?? new List()) .Map(list => list.Map(metadata => ProjectToShow(metadata, library.MediaSourceId))); } diff --git a/ErsatzTV.Infrastructure/Search/SearchIndex.cs b/ErsatzTV.Infrastructure/Search/SearchIndex.cs index 5d98577a4..6ca957e30 100644 --- a/ErsatzTV.Infrastructure/Search/SearchIndex.cs +++ b/ErsatzTV.Infrastructure/Search/SearchIndex.cs @@ -1,4 +1,5 @@ using System.Globalization; +using Bugsnag; using ErsatzTV.Core; using ErsatzTV.Core.Domain; using ErsatzTV.Core.Interfaces.Metadata; @@ -173,11 +174,21 @@ public sealed class SearchIndex : ISearchIndex return Task.FromResult(Unit.Default); } - public Task Search(string searchQuery, int skip, int limit, string searchField = "") + public SearchResult Search(IClient client, string searchQuery, int skip, int limit, string searchField = "") { + var metadata = new Dictionary + { + { "searchQuery", searchQuery }, + { "skip", skip.ToString() }, + { "limit", limit.ToString() }, + { "searchField", searchField } + }; + + client.Breadcrumbs.Leave("SearchIndex.Search", BreadcrumbType.State, metadata); + if (string.IsNullOrWhiteSpace(searchQuery.Replace("*", string.Empty).Replace("?", string.Empty))) { - return new SearchResult(new List(), 0).AsTask(); + return new SearchResult(new List(), 0); } using DirectoryReader reader = _writer.GetReader(true); @@ -214,7 +225,7 @@ public sealed class SearchIndex : ISearchIndex searchResult.PageMap = GetSearchPageMap(searcher, query, filter, sort, limit); } - return searchResult.AsTask(); + return searchResult; } public void Commit() => _writer.Commit(); diff --git a/ErsatzTV/Pages/Channels.razor b/ErsatzTV/Pages/Channels.razor index ab32c93a5..2933e8c3b 100644 --- a/ErsatzTV/Pages/Channels.razor +++ b/ErsatzTV/Pages/Channels.razor @@ -109,7 +109,10 @@ if (!result.Cancelled) { await _mediator.Send(new DeleteChannel(channel.Id), _cts.Token); - await _table.ReloadServerData(); + if (_table != null) + { + await _table.ReloadServerData(); + } } } diff --git a/ErsatzTV/Pages/Collections.razor b/ErsatzTV/Pages/Collections.razor index a68530955..2a4b314a1 100644 --- a/ErsatzTV/Pages/Collections.razor +++ b/ErsatzTV/Pages/Collections.razor @@ -170,7 +170,10 @@ if (!result.Cancelled) { await _mediator.Send(new DeleteCollection(collection.Id), _cts.Token); - await _collectionsTable.ReloadServerData(); + if (_collectionsTable != null) + { + await _collectionsTable.ReloadServerData(); + } } } @@ -184,7 +187,10 @@ if (!result.Cancelled) { await _mediator.Send(new DeleteMultiCollection(collection.Id), _cts.Token); - await _multiCollectionsTable.ReloadServerData(); + if (_multiCollectionsTable != null) + { + await _multiCollectionsTable.ReloadServerData(); + } } } @@ -198,7 +204,10 @@ if (!result.Cancelled) { await _mediator.Send(new DeleteSmartCollection(collection.Id), _cts.Token); - await _smartCollectionsTable.ReloadServerData(); + if (_smartCollectionsTable != null) + { + await _smartCollectionsTable.ReloadServerData(); + } } } diff --git a/ErsatzTV/Pages/FillerPresets.razor b/ErsatzTV/Pages/FillerPresets.razor index 6b46bfb89..3117e7d91 100644 --- a/ErsatzTV/Pages/FillerPresets.razor +++ b/ErsatzTV/Pages/FillerPresets.razor @@ -92,7 +92,10 @@ if (!result.Cancelled) { await _mediator.Send(new DeleteFillerPreset(fillerPreset.Id), _cts.Token); - await _fillerPresetsTable.ReloadServerData(); + if (_fillerPresetsTable != null) + { + await _fillerPresetsTable.ReloadServerData(); + } } } diff --git a/ErsatzTV/Pages/Playouts.razor b/ErsatzTV/Pages/Playouts.razor index a7ead1ba7..ec1b58ab5 100644 --- a/ErsatzTV/Pages/Playouts.razor +++ b/ErsatzTV/Pages/Playouts.razor @@ -115,7 +115,7 @@ if (_showFiller != value) { _showFiller = value; - if (_selectedPlayoutId != null) + if (_detailTable != null && _selectedPlayoutId != null) { _detailTable.ReloadServerData(); } @@ -142,7 +142,10 @@ private async Task PlayoutSelected(PlayoutNameViewModel playout) { _selectedPlayoutId = playout.PlayoutId; - await _detailTable.ReloadServerData(); + if (_detailTable != null) + { + await _detailTable.ReloadServerData(); + } } private async Task DeletePlayout(PlayoutNameViewModel playout) @@ -155,7 +158,10 @@ if (!result.Cancelled) { await _mediator.Send(new DeletePlayout(playout.PlayoutId), _cts.Token); - await _table.ReloadServerData(); + if (_table != null) + { + await _table.ReloadServerData(); + } if (_selectedPlayoutId == playout.PlayoutId) { _selectedPlayoutId = null; @@ -166,7 +172,10 @@ private async Task ResetPlayout(PlayoutNameViewModel playout) { await _mediator.Send(new BuildPlayout(playout.PlayoutId, PlayoutBuildMode.Reset), _cts.Token); - await _table.ReloadServerData(); + if (_table != null) + { + await _table.ReloadServerData(); + } if (_selectedPlayoutId == playout.PlayoutId) { await PlayoutSelected(playout); @@ -187,7 +196,10 @@ IDialogReference dialog = await _dialog.ShowAsync("Schedule Playout Reset", parameters, options); await dialog.Result; - await _table.ReloadServerData(); + if (_table != null) + { + await _table.ReloadServerData(); + } } private async Task> ServerReload(TableState state) diff --git a/ErsatzTV/Pages/Schedules.razor b/ErsatzTV/Pages/Schedules.razor index 3a04a189b..39954d143 100644 --- a/ErsatzTV/Pages/Schedules.razor +++ b/ErsatzTV/Pages/Schedules.razor @@ -113,7 +113,10 @@ private async Task ScheduleSelected(ProgramScheduleViewModel schedule) { _selectedSchedule = schedule; - await _detailTable.ReloadServerData(); + if (_selectedSchedule != null && _detailTable != null) + { + await _detailTable.ReloadServerData(); + } } private async Task DeleteSchedule(ProgramScheduleViewModel programSchedule) @@ -126,7 +129,10 @@ if (!result.Cancelled) { await _mediator.Send(new DeleteProgramSchedule(programSchedule.Id), _cts.Token); - await _table.ReloadServerData(); + if (_table != null) + { + await _table.ReloadServerData(); + } if (_selectedSchedule == programSchedule) { _selectedSchedule = null; diff --git a/ErsatzTV/Pages/TraktLists.razor b/ErsatzTV/Pages/TraktLists.razor index 805ce9e77..b98de198b 100644 --- a/ErsatzTV/Pages/TraktLists.razor +++ b/ErsatzTV/Pages/TraktLists.razor @@ -94,7 +94,7 @@ InvokeAsync(async () => { StateHasChanged(); - if (!_locker.IsTraktLocked()) + if (_traktListsTable != null && !_locker.IsTraktLocked()) { await _traktListsTable.ReloadServerData(); }