-
Notifications
You must be signed in to change notification settings - Fork 0
[feat] #154 사진 추가 시 아카이빙 메인 화면 재갱신 #155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
81e6377
[feat] #154: 사진 업로드 후 아카이브 화면 갱신
ikseong00 d72a0a4
[refactor] #154: 아카이빙 메인 화면 새로고침 로직 개선
ikseong00 d1f12a2
[refactor] #154: Compose 런타임 최적화를 위해 ResultEventBus에 @Stable 적용
ikseong00 edb21bc
[refactor] #154: 아카이빙 화면 사진 업로드 관련 로직 제거
ikseong00 ad0059e
[refactor] #154: ResultEventBus의 channelMap 타입 선언 제거
ikseong00 08b4282
[refactor] #154: ResultEventBus 클래스에서 @Stable 어노테이션 제거
ikseong00 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
현재 상태에서
ResultEventBus.channelMap의 밸류에 직접 접근하는 부분이 없어 문제되지는 않을 것 같지만Map의 밸류로Cannel타입을 갖기 때문에@Stable조건을 만족하지 못하는 것 같습니다!?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
지적 감사합니다!
말씀하신 대로 Channel이 @stable 조건을 엄밀히 만족하지 않는 건 맞습니다. 다만 @stable을 제거하면 ResultEventBus 자체가 unstable로 추론되어 불필요한 recomposition이 발생할 수 있습니다.
MainRoute에서 리컴포지션이 발생하면,ResultEffect는 unstable 해지기 때문에 반드시 리컴포지션이 발생합니다.따라서 해당
ResultEventBus클래스를 stable 하진 않지만@Stable하다고 명시하여 불필요한 리컴포지션을 줄일 수 있습니다!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
말씀하신 부분은 이해가 되어 로그를 통해 실제로 리컴포지션을 줄일 수 있는지 확인을 해 보았는데요.
ResultEffect의 경우@Stable어노테이션에 관계 없이 리컴포지션이 동일하게 발생하는 것 같습니다.?.?제가 확인한 바로는
ResultEffect의 경우inline함수이고,MainRoute에서 리컴포지션이 발생하면 독립적인 리컴포지션의 대상이 아니기 때문에(inline 함수의 경우 접근할 때 그대로 함수를 가지고 오기 때문에) 항상 다시 작성되는 것으로 이해했습니다.결국
ResultEffect()내부의LaunchedEffect구문에 설정된 키의 영향을 받는데 키로 설정된resultKey,resultEventBus.channelMap[resultKey]는MainRoute가 리컴포지션 되더라도 각각String과Channel<Any?>타입이기 때문에MainRoute의 리컴포지션과는 무관하게 설정된 키의 변화에 따라LaunchedEffect블럭의 코드가 트리거 되는 것 같습니다.제가 확인하지 못한
MainRoute의 리컴포지션 시에 해당 키의 변화가 있는지, 추가적으로 확인한 내용이 올바르게 이해한 것인지는 모르겠네요...! 리컴포지션 어렵다어려워There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아하,
inline함수가 된다면 실제 코드에서 이렇게 반영이 되는군요,그래서 말씀하신 것처럼
ResultEffect가 내부 함수로 펼쳐지기(?) 때문에 리컴포지션 대상 자체가 안되네요!inline이 기본 함수에만 작동되는 줄 알았는데 코틀린 기본 개념처럼 진짜 코드 인라인에 복사되는 거기 때문에 실행 환경에선ResultEffect가 없어진 거나 마찬가지가 되어 해당 함수의 Stability 를 설정할 필요가 없네요.(무작정 복붙 가져오기의 폐해...)
LaunchedEffect의 키에는ResultEventBus인스턴스 자체는 상관이 없으니@Stable어노테이션이 의미가 없겠네요.08b4282 불필요한
@Stable어노테이션 제거했습니다!