Skip to content

Conversation

NBA2K1
Copy link
Contributor

@NBA2K1 NBA2K1 commented Jun 7, 2025

This PR includes several improvements and bug fixes:

✅ Fixes

  • Handle Missing URI in fetch_sources_list.dart
    Prevents an exception when source.sourceCodeUrl is empty. Now gracefully handles empty URLs to avoid:
ArgumentError (Invalid argument(s): No host specified in URI )
  • Fix Extension Reinstallation Bug
    Fixed an issue where an extension couldn't be reinstalled after being uninstalled unless the app was restarted.
    The provider is now correctly invalidated, allowing Riverpod to trigger fresh fetch logic and avoid stale cache due to keepAlive.

Before:

before.mp4

After:

after.mp4

 

🔄 Refactor

  • Merged Duplicate Providers
    Combined fetchMangaSourcesListProvider, fetchAnimeSourcesListProvider, and fetchNovelSourcesListProvider into a unified FetchItemSourcesListProvider, reducing redundancy and improving maintainability.

🧵 Async Improvements

  • Made Write Transaction Fully Async
    Replaced incorrect usage of:
isar.writeTxnSync(() async {

with a fully async approach.
Mixing writeTxnSync with await was invalid and could cause undefined behavior.

NBA2K1 added 4 commits June 6, 2025 21:43
```
Exception has occurred.
ArgumentError (Invalid argument(s): No host specified in URI )
```

at line 79:
`final req = await http.get(Uri.parse(source.sourceCodeUrl!));`
when source.sourceCodeUrl is empty.
Mixing `writeTxnSync` with `await` was incorrect.
writeTxnSync does not support awaiting async functions.
There was a bug when uninstalling an extension and trying to reinstall it, it didn't install.
You had to restart the app to reinstall the same extension again.
Now the provider is invalidated when reinstalling an uninstalled extension,
so the fetch logic is triggered correctly. Prevents stale cache issues from
Riverpod's keepAlive behavior.
Merge `fetchMangaSourcesListProvider`, `fetchAnimeSourcesListProvider` and `fetchNovelSourcesListProvider` into a single Provider, `FetchItemSourcesListProvider`, reducing code duplication.
@kodjodevf kodjodevf merged commit 183e88e into kodjodevf:main Jun 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants