Skip to content

Commit

Permalink
fixes error update triggering unnecessary updates
Browse files Browse the repository at this point in the history
  • Loading branch information
bdbch committed Jul 26, 2019
1 parent d9c43d0 commit 802a2fb
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/lib/branch/useBranch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ export default function useBranch(
branchName.length > 0
) {
setLoading(true);
setError(null);
setError(undefined);
fetch(
`https://api.github.com/repos/${owner}/${repo}/branches/${branchName}`
)
.then(res => res.json())
.then(data => {
setLoading(false);
setBranch(data);
setError(null);
setError(undefined);
})
.catch(e => {
setLoading(false);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/branch/useBranches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ export default function useBranches(
useEffect(() => {
if (repo && repo.length > 0 && owner && owner.length) {
setLoading(true);
setError(null);
setError(undefined);
fetch(`https://api.github.com/repos/${owner}/${repo}/branches`)
.then(res => res.json())
.then(data => {
setLoading(false);
setBranches(data);
setError(null);
setError(undefined);
})
.catch(e => {
setLoading(false);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/release/useLatestRelease.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function useLatestRelease(

useEffect(() => {
if (owner && owner.length > 0 && repo && repo.length > 0) {
setError(null);
setError(undefined);
setLoading(true);

fetch(`https://api.github.com/repos/${owner}/${repo}/releases/latest`)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/release/useTaggedRelease.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function useTaggedRelease(
tag &&
tag.length > 0
) {
setError(null);
setError(undefined);
setLoading(true);

fetch(
Expand Down
4 changes: 2 additions & 2 deletions src/lib/repository/useCollaborators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ export default function useCollaborators(
useEffect(() => {
if (repo && repo.length > 0 && owner && owner.length) {
setLoading(true);
setError(null);
setError(undefined);
fetch(`https://api.github.com/repos/${owner}/${repo}/collaborators`)
.then(res => res.json())
.then(data => {
setLoading(false);
setCollaborators(data);
setError(null);
setError(undefined);
})
.catch(e => {
setLoading(false);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/repository/useForks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ export default function useForks(owner: string, repo: string): IForksResponse {
useEffect(() => {
if (repo && repo.length > 0 && owner && owner.length) {
setLoading(true);
setError(null);
setError(undefined);
fetch(`https://api.github.com/repos/${owner}/${repo}/forks`)
.then(res => res.json())
.then(data => {
setLoading(false);
setForks(data);
setError(null);
setError(undefined);
})
.catch(e => {
setLoading(false);
Expand Down

0 comments on commit 802a2fb

Please sign in to comment.