File tree Expand file tree Collapse file tree 3 files changed +30
-18
lines changed
Expand file tree Collapse file tree 3 files changed +30
-18
lines changed Original file line number Diff line number Diff line change @@ -36,13 +36,17 @@ export default function LazyEducationSection() {
3636 } , [ certifications ] ) ;
3737
3838 const loadEducationData = useCallback ( async ( ) => {
39- if ( ! loadedSections . education && ! loading ) {
40- const wasSuccessful = await fetchEducation ( ) ;
41- if ( wasSuccessful ) {
42- setSectionLoaded ( 'education' ) ;
43- setHasLoaded ( true ) ;
44- }
39+ if ( loadedSections . education || loading ) {
40+ return loadedSections . education ;
41+ }
42+
43+ const wasSuccessful = await fetchEducation ( ) ;
44+ if ( wasSuccessful ) {
45+ setSectionLoaded ( 'education' ) ;
46+ setHasLoaded ( true ) ;
4547 }
48+
49+ return wasSuccessful ;
4650 } , [
4751 loadedSections . education ,
4852 loading ,
Original file line number Diff line number Diff line change @@ -21,13 +21,17 @@ export default function LazyExperienceSection() {
2121 const [ hasLoaded , setHasLoaded ] = useState ( false ) ;
2222
2323 const loadExperienceData = useCallback ( async ( ) => {
24- if ( ! loadedSections . experience && ! loading ) {
25- const wasSuccessful = await fetchExperiences ( ) ;
26- if ( wasSuccessful ) {
27- setSectionLoaded ( 'experience' ) ;
28- setHasLoaded ( true ) ;
29- }
24+ if ( loadedSections . experience || loading ) {
25+ return loadedSections . experience ;
3026 }
27+
28+ const wasSuccessful = await fetchExperiences ( ) ;
29+ if ( wasSuccessful ) {
30+ setSectionLoaded ( 'experience' ) ;
31+ setHasLoaded ( true ) ;
32+ }
33+
34+ return wasSuccessful ;
3135 } , [
3236 loadedSections . experience ,
3337 loading ,
Original file line number Diff line number Diff line change @@ -20,13 +20,17 @@ export default function LazyProjectsSection() {
2020 const [ hasLoaded , setHasLoaded ] = useState ( false ) ;
2121
2222 const loadProjectsData = useCallback ( async ( ) => {
23- if ( ! loadedSections . projects && ! loading ) {
24- const wasSuccessful = await fetchProjects ( ) ;
25- if ( wasSuccessful ) {
26- setSectionLoaded ( 'projects' ) ;
27- setHasLoaded ( true ) ;
28- }
23+ if ( loadedSections . projects || loading ) {
24+ return loadedSections . projects ;
2925 }
26+
27+ const wasSuccessful = await fetchProjects ( ) ;
28+ if ( wasSuccessful ) {
29+ setSectionLoaded ( 'projects' ) ;
30+ setHasLoaded ( true ) ;
31+ }
32+
33+ return wasSuccessful ;
3034 } , [
3135 loadedSections . projects ,
3236 loading ,
You can’t perform that action at this time.
0 commit comments