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

Update notice when new version is live #223

Merged
merged 5 commits into from
Sep 29, 2020

Conversation

MoltenCoffee
Copy link
Contributor

@MoltenCoffee MoltenCoffee commented Sep 26, 2020

Hi!
I was looking into the option to notify users when a new version is available, and add a little bit of code to do just that. It uses the GitHub API to retrieve data about releases, and compares the tag_name to the version of the running instance (via process.env.VERSION).

When a new version is available, a banner is displayed on top of pages when logged in. As I'm writing this I notice a Toast-component as well, but I don't know what's the right trade-off between the importance of updating, user-friendliness and visibility.

At the moment, although it's wrapped in useMemo, it will pretty much fetch the GitHub API on every render, which of course is a tad overkill. Storing the last time it checked for a new version, and the latest version at that moment in Local- or Sessionstorage to check once every session or day, would probably be a better option. I have never worked with Redux however, so I didn't implement it as of now.

Consider this PR more of a proof of concept as of now! Would love to hear some thoughts.

Edit: this uses v3 of the GitHub API, which is still REST. I assume this will be supported for some time, although they seem to be actively pushing to using the GraphQL version. GitHub states you should explicitely state the version in an Accept header, this is not implemented here, but it still works.

@mikecao
Copy link
Collaborator

mikecao commented Sep 27, 2020

I'll pull this in and make some changes later. Will probably use redux or localStorage so we don't keep checking. This should also be configurable in Settings, maybe opt-out by default. Also this should only display to the admin since other users won't have any control over the installation.

@mikecao mikecao merged commit 9f9208a into umami-software:dev Sep 29, 2020
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