Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Migrate manage snaps providers #1737

Merged
merged 20 commits into from
Jul 17, 2024

Conversation

spydon
Copy link
Collaborator

@spydon spydon commented Jul 11, 2024

This migrates the providers for the manage page to the modern style (#1676) it also fixes #1551.

If there is no internet connection, we currently show this:
Screenshot from 2024-07-16 19-43-54
And if you click check for updates and the connection is back, it will be going back to its normal state.

@spydon spydon requested a review from d-loose July 11, 2024 17:06
@spydon spydon force-pushed the refactor/migrate-manage-snaps-providers branch from a65cd07 to e03b704 Compare July 11, 2024 17:08
@spydon spydon force-pushed the refactor/migrate-manage-snaps-providers branch from e03b704 to 2c0f752 Compare July 11, 2024 17:14
@spydon spydon force-pushed the refactor/migrate-manage-snaps-providers branch from 7804a99 to e742b06 Compare July 12, 2024 08:15
@d-loose
Copy link
Member

d-loose commented Jul 12, 2024

Looks really good at first glance! I'll add some more detailed comments later. One thing I noticed so far is that the manage page won't work without a network connection (and even the tile in the sidebar breaks)

image

@d-loose
Copy link
Member

d-loose commented Jul 12, 2024

Another nitpick: changing the filters for the list of installed snaps now shows a loading spinner for a very short time, causing a bit of a flicker

@spydon
Copy link
Collaborator Author

spydon commented Jul 12, 2024

Another nitpick: changing the filters for the list of installed snaps now shows a loading spinner for a very short time, causing a bit of a flicker

Good catch! Fixed in 5c4e9a9

packages/app_center/test/manage_page_test.dart Outdated Show resolved Hide resolved
Comment on lines 15 to 16
final refreshableSnapNames =
(await ref.watch(updatesModelProvider.future)).snapNames;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if it'd be better to disentangle the updates from the manage model entirely, or at least use select more often to avoid unnecessary rebuilds and loading states. For example:

Before:

Screencast.from.2024-07-12.11-54-33.webm

After:

Screencast.from.2024-07-12.11-54-55.webm

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I forgot about this, I had them separately first, but there was some problem with the slivers.
I'll try that again!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the latest changes the loading state behavior is still a bit different

Screencast.from.2024-07-15.17-01-24.webm

I'm wondering what's the best option here - do we need to hide the list of installed snaps during the loading state?
@anasereijo do you have an opinion on that?

packages/app_center/lib/manage/manage_page.dart Outdated Show resolved Hide resolved
packages/app_center/lib/snapd/snap_model.dart Show resolved Hide resolved
packages/app_center/lib/snapd/snap_page.dart Outdated Show resolved Hide resolved
try {
return _snapd.find(filter: SnapFindFilter.refresh);
} on SnapdException catch (_) {
// TODO: Should we ignore all SnapdExceptions here?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, with the new error handling setup, we probably shouldn't catch any errors at all here, and let them be handled by the custom error view (like here) or the top-level error dialog

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then it won't work when we don't have internet though, will it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah very good point - I'm obviously contradicting myself here :D
But we need to somehow inform the user that we couldn't fetch updates due to network issues.

Comment on lines +28 to +29
// When kind is null it is most likely a problem with the internet
// connection.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not generally true, see #1684, which is a case that we'd need to handle differently I think.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aaah, how annoying, if we expose statusCode and maybe status in the SnapdClient maybe we can solve this in a better way.

Copy link
Member

@d-loose d-loose left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I think d1e3b04 is a big improvement!

But I do have more loading state nitpicks:

Related to a previous comment, it seems weird to me that the list of snaps enters a loading state, but the list of updateable snaps doesn't:

Screencast.from.2024-07-17.10-03-47.webm

Starting app center without network connection, waiting for the connection timeout - there are many loading spinners:
Screenshot from 2024-07-17 10-16-34

Eventually a message that indicates the network state is displayed 👍 - but when checking for updates again, only the list of installed snaps enters a loading state:

Screenshot from 2024-07-17 10-19-29

Copy link
Member

@d-loose d-loose left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM now 👍
We should leave further improvements concerning error handling and offline behavior to future PRs 🙂

@spydon spydon merged commit 7c0fee1 into main Jul 17, 2024
8 checks passed
@spydon spydon deleted the refactor/migrate-manage-snaps-providers branch July 17, 2024 13:02
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.

Apps installed locally are showing grey screen after delete
2 participants