Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Frontend-MECRED
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MECRED
Frontend-MECRED
Commits
3fe0ede5
Commit
3fe0ede5
authored
1 month ago
by
tbt20
Browse files
Options
Downloads
Patches
Plain Diff
HOTFIZ loading
parent
6a75cf98
No related branches found
No related tags found
1 merge request
!297
HOTFIX: Loading spinner no MEC
Pipeline
#42342
passed
1 month ago
Stage: build
Changes
2
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/app/components/InfiniteScroll.js
+10
-5
10 additions, 5 deletions
src/app/components/InfiniteScroll.js
src/app/components/Loading.js
+1
-1
1 addition, 1 deletion
src/app/components/Loading.js
with
11 additions
and
6 deletions
src/app/components/InfiniteScroll.js
+
10
−
5
View file @
3fe0ede5
...
...
@@ -31,7 +31,7 @@ const getUrlFromFilterState = (filterState, page) => {
*/
export
default
function
InfiniteScroll
({
filterState
,
setNewSize
,
newSize
,
setItems
,
items
,
abortController
})
{
const
[
isLoading
,
setIsLoading
]
=
useState
(
false
);
const
[
mecLoading
,
setMecLoading
]
=
useState
(
fals
e
);
const
[
mecLoading
,
setMecLoading
]
=
useState
(
tru
e
);
const
[
page
,
setPage
]
=
useState
(
0
);
const
[
isScroll
,
setIsScroll
]
=
useState
(
false
)
const
router
=
useRouter
();
...
...
@@ -40,7 +40,9 @@ export default function InfiniteScroll({ filterState, setNewSize, newSize, setIt
const
[
totalCount
,
setTotalCount
]
=
useState
(
1
)
const
fetchData
=
useCallback
(
async
(
page
)
=>
{
setIsLoading
(
true
);
const
url
=
getUrlFromFilterState
(
filterState
,
page
);
try
{
const
{
data
,
headers
}
=
await
mecredApi
.
get
(
url
,
{
...
...
@@ -85,7 +87,8 @@ export default function InfiniteScroll({ filterState, setNewSize, newSize, setIt
}
// Busca mais dados
fetchData
(
page
);
// Só faz a requisição se não for na página do MEC
!
(
filterState
.
searchClass
==
"
MEC
"
)
&&
fetchData
(
page
);
},
[
fetchData
,
isLoading
,
page
]);
//caso o filtro seja alterado, seta o site para o topo da tela
...
...
@@ -99,7 +102,6 @@ export default function InfiniteScroll({ filterState, setNewSize, newSize, setIt
window
.
addEventListener
(
"
scroll
"
,
handleScroll
);
return
()
=>
window
.
removeEventListener
(
"
scroll
"
,
handleScroll
);
},
[
isLoading
,
handleScroll
]);
return
(
<>
...
...
@@ -116,8 +118,11 @@ export default function InfiniteScroll({ filterState, setNewSize, newSize, setIt
}
<
/div
>
{(
isLoading
||
!
mecLoading
)
&&
{
filterState
.
searchClass
==
"
MEC
"
?
(
mecLoading
)
&&
<
Loading
scroll
=
{
false
}
/> :
(
isLoading
)
&&
<
Loading
scroll
=
{
isScroll
}
/
>
}
<
/
>
...
...
This diff is collapsed.
Click to expand it.
src/app/components/Loading.js
+
1
−
1
View file @
3fe0ede5
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment