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

UI: refresh plugins interval #3663

Merged

Conversation

ordabach
Copy link
Contributor

@ordabach ordabach commented Sep 7, 2023

What does this PR do?

Fixes part of #3418

  • Add an hourly interval to force refresh plugins

PR Checklist

  • Have you added an explanation of what your changes do and why you'd like to include them?
  • Is the TravisCI build passing?
  • Was the CHANGELOG.md updated to reflect the changes?
  • Was the documentation framework updated to reflect the changes?
  • Have you checked that you haven't introduced any duplicate code?

Testing Checklist

  • Added relevant unit tests?
  • Do all unit tests pass?
  • Do all end-to-end tests pass?
  • Any other testing performed?

    Tested by {Running the Monkey locally with relevant config/running Island/...}

  • If applicable, add screenshots or log transcripts of the feature working

@ordabach ordabach changed the base branch from develop to 3418-plugin-installation-screen September 7, 2023 08:40
@@ -0,0 +1,23 @@
import {useEffect, useRef} from 'react'

export const useInterval = (callback: () => void, delay: number | null) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we should or need to override this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what do you mean?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand why we need to wrap the useInterval and what this wrapping achieves

Copy link
Contributor Author

Choose a reason for hiding this comment

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

a general hook to use interval with self-cleaning.

Comment on lines +6 to +9
// Remember the latest callback if it changes
useEffect(() => {
savedCallback.current = callback;
}, [callback])
Copy link
Contributor

Choose a reason for hiding this comment

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

What for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's the practice

}, [installedPlugins]);

const refreshAvailablePluginsAndNumberOfUpgradablePlugins = (forceRefresh = false) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

In general this is not a good name. If a name is "DoSomething1andDoSomething2" it means that there are 2 functions: "DoSomething1" and "DoSomething2". So we should just call "DoSomething1" and "DoSomething2" in a row instead of creating another function. But since there's a temporal coupling, I don't feel strongly about this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you can change it if you have a better one

This race condition happens when available plugin rows are created before the availablePlugins variable is updated.
@ordabach ordabach merged commit f862fe7 into 3418-plugin-installation-screen Sep 7, 2023
@VakarisZ VakarisZ deleted the 3418-update-plugins-interval branch September 15, 2023 13:35
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