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

Improve loading speed for updater page #7140

Merged
merged 6 commits into from
Nov 29, 2022

Conversation

arthurperton
Copy link
Contributor

I've been noticing for a while that the updater page takes a long time to load. The same goes for the updater badge. Also the updater page doesn't show a loading indicator. This PR fixes / improves these issues.

Most of the loading time (several seconds each) was spent parsing the markdown in GithubReleasePresenter@toHtml() and determining if a version was a 'upgrade', 'current' or 'downgrade' version in Changelog@parseReleaseType().

Changes:

  • Parse markdown on the frontend
  • Remember the release type, everything after the first 'downgrade' must be a downgrade too*
  • Start loading the changelog in the Vue created() method instead of waiting for mounted()
  • Fix a JS error that prevented the loading indicator from rendering

* This assumes that the API returns the releases sorted, latest release first. Which seems to be the case.

@what-the-diff
Copy link

what-the-diff bot commented Nov 29, 2022

  • The body attribute of the release object is now a string instead of an HTML-formatted string.
  • The GithubReleasePresenter class has been deprecated and removed from the codebase, as it was only used in one place (the ChangelogTests test).
  • In Release.vue, we have added some logic to format markdown strings into html with labels for new features/fixes/breaking changes etc., which were previously formatted by GithubReleasePresenter before being passed down to VueJS via props on mount(). This change also removes any references to this presenter throughout the codebase (including tests) and replaces them with calls directly to Marketplace::releases() or $this->getChangelog(), depending on context - see UpdaterTest for examples where these methods are called within PHPUnit tests that need access to changelogs without mounting components first; otherwise they can be accessed through component props after mounting occurs in other places such as UpdaterController@index().

Copy link
Member

@jasonvarga jasonvarga left a comment

Choose a reason for hiding this comment

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

Nice.

I've marked the presenter class as deprecated since now it's not used anywhere. I haven't removed it completely because maybe someone else is using it.

@jasonvarga jasonvarga merged commit 7398488 into statamic:3.3 Nov 29, 2022
@arthurperton arthurperton deleted the fix/updater-page-speed branch November 29, 2022 15:15
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