Skip to content

Conversation

@DongJun-H
Copy link
Member

작업 목표

  • 최초 키워드 검색 이후, 타 키워드 검색후에도 상세페이지로 이동후 검색결과 화면으로 돌아오는 경우 항상 최초 키워드 검색화면이 표시되는 현상 해결

작업 사항

  • 검색결과 이동시에 searchKeyword를 이용해 route를 설정해 이동하는데, 최초 키워드 검색 이후 이를 갱신하지 않아서 생기는 문제에 대한 해결
    • Composable 내부에서 viewmodel의 searchKeyword 함수만 호출함에따라, NavBackStackEntry의 param searchkeyword는 그대로 남아있고, 상세페이지에서 돌아가는 경우 다시 그 값으로 recomposition 되기 때문에 발생했던 문제
  • 기존에 viewModel을 이용해 검색 결과를 갱신하던 방식에서 기존의 route에 searchKeyword를 설정하는 방식을 활용해, 검색할때마다 route인자를 변경해 화면전환을 통해 결과값을 보여주고, 직전 키워드 검색 화면은 Stack에서 제거함으로써 해결

참고

@DongJun-H DongJun-H requested review from Copilot and yuni-ju May 28, 2025 11:52
@DongJun-H DongJun-H self-assigned this May 28, 2025
@DongJun-H DongJun-H added the bug Something isn't working label May 28, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR changes the search flow so that navigating back to the results always shows the most recent keyword search by embedding the keyword in the route and popping the previous result from the back stack.

  • Switches from calling viewModel.searchKeyword(...) in-place to using navController.navigate(...) with a route parameter
  • Updates SearchResultRoute, SearchNavigation, and MainScreen to accept and propagate NavController
  • Removes the previous search-result screen from the back stack when navigating

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
presentation/.../SearchResultScreen.kt Added NavController parameter and new onSearchClick logic
presentation/.../SearchNavigation.kt Passed NavController into searchNavGraph
presentation/.../MainScreen.kt Supplied navController to searchNavGraph
Comments suppressed due to low confidence (3)

presentation/src/main/java/daily/dayo/presentation/screen/search/SearchNavigation.kt:22

  • It looks like the SearchRoute.resultSearch(...) destination isn't defined in this navigation graph, so the navController.navigate() call may fail at runtime. Please add a composable entry for the resultSearch route with the correct parameter pattern.
fun NavGraphBuilder.searchNavGraph(

presentation/src/main/java/daily/dayo/presentation/screen/search/SearchResultScreen.kt:105

  • [nitpick] Passing NavController into this UI-level composable couples navigation logic with UI. Consider passing an onSearchNavigate callback instead to decouple navigation from presentation logic.
internal fun SearchResultRoute(

presentation/src/main/java/daily/dayo/presentation/screen/search/SearchResultScreen.kt:137

  • New navigation logic via navController.navigate should be covered by an integration or UI test to verify that the back stack is updated correctly and the expected screen displays for different keywords.
onSearchClick = { newKeyword ->

@github-project-automation github-project-automation bot moved this from Todo to In Progress in DAYO 2.0 May 28, 2025
@DongJun-H DongJun-H merged commit 501a504 into develop Jun 2, 2025
1 check passed
@DongJun-H DongJun-H deleted the bug/issue-660 branch June 2, 2025 11:27
@github-project-automation github-project-automation bot moved this from In Progress to Done in DAYO 2.0 Jun 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants