본문 바로가기
콤퓨타/캡스톤프로젝트

캡스톤프로젝트 (5) - 안드로이드 중복 api call 제어

by 다_녤 2024. 5. 12.
반응형

기존 Composable function으로 구성된 화면에서 API call을 하는데, Logcat을 확인해보면 여러차례 Retrofit API call을 하는 것을 확인할 수 있었습니다.

 

LaunchedEffect를 통해 Coroutine을 적용하여 한번의 call만 진행할 수 있게 코드를 수정하였습니다.

 

[그림] 코드수정

 

[그림] 한번만 로드되는 HomeScreen

 

https://github.com/CodeHanZoom/greenwalk_android/commit/20b38866be36eeedceea234077a8650ef41dcf5f

 

Feat: add coruntine logic for getting userInfo · CodeHanZoom/greenwalk_android@20b3886

MCYJ committed May 11, 2024

github.com

 

반응형