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

Typescript UI #434

Merged
merged 83 commits into from
Oct 20, 2020
Merged

Typescript UI #434

merged 83 commits into from
Oct 20, 2020

Conversation

grubach
Copy link
Contributor

@grubach grubach commented Oct 16, 2020

No description provided.

@grubach grubach requested a review from adamw October 16, 2020 13:44
@adamw adamw mentioned this pull request Oct 19, 2020

React.useEffect(() => {
load();
// eslint-disable-next-line react-hooks/exhaustive-deps

Choose a reason for hiding this comment

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

In order to get rid of this es-lint-disable you can extract the inline callback from usePromise to a function declared outside of the component, and then use this function inside usePromise and then use the load function in the dependencies array e.g.
const getVersion = () => versionService.getVersion(); const Footer: React.FC = () => { const [result, load] = usePromise<VersionData, any, any>(getVersion); React.useEffect(() => { load(); }, [load]); (...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

versionService.getVersion() is already a function declared outside component in separate module. load changes reference anyway and causes rerender.

!result.isIdle && clear();
});

return result.match({

Choose a reason for hiding this comment

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

❤️

@adamw adamw merged commit 078a881 into master Oct 20, 2020
@mergify mergify bot deleted the typescript-ui branch October 20, 2020 14:47
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.

4 participants