mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-18 11:46:33 -07:00
[Bugfix] Fixed refreshing details screens
This commit is contained in:
parent
8bda03ee2c
commit
aaa6a737cb
4 changed files with 10 additions and 13 deletions
|
|
@ -18,14 +18,15 @@ class MovieDetails extends _$MovieDetails {
|
|||
|
||||
Future<Response?> fetchDetails(ItemBaseModel item) async {
|
||||
try {
|
||||
if (item is MovieModel && state == null) {
|
||||
state = item;
|
||||
if (item is MovieModel) {
|
||||
state = state ?? item;
|
||||
}
|
||||
MovieModel? newState;
|
||||
final response = await api.usersUserIdItemsItemIdGet(itemId: item.id);
|
||||
if (response.body == null) return null;
|
||||
state = response.bodyOrThrow as MovieModel;
|
||||
newState = (response.bodyOrThrow as MovieModel).copyWith(related: state?.related);
|
||||
final related = await ref.read(relatedUtilityProvider).relatedContent(item.id);
|
||||
state = state?.copyWith(related: related.body);
|
||||
state = newState.copyWith(related: related.body);
|
||||
return null;
|
||||
} catch (e) {
|
||||
_tryToCreateOfflineState(item);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue