Skip to content
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

Read more replies does not work, and pressing it too much will cause a crash #1183

Closed
MV-GH opened this issue Aug 16, 2023 · 6 comments · Fixed by #1240
Closed

Read more replies does not work, and pressing it too much will cause a crash #1183

MV-GH opened this issue Aug 16, 2023 · 6 comments · Fixed by #1240
Labels
bug Something isn't working

Comments

@MV-GH
Copy link
Collaborator

MV-GH commented Aug 16, 2023

Jerboa Version

0.0.44

Android Version + Phone

N/A

Describe The Bug

Press read more replies nothing happens, press it again nothing happens, start scrolling, crash

stack trace FATAL EXCEPTION: main Process: com.jerboa, PID: 26802 java.lang.IllegalArgumentException: Key "1996313" was already used. If you are using LazyColumn/Row please make sure you provide a unique key for each item. at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$Scope.subcompose(Unknown Source:182) at androidx.compose.foundation.lazy.layout.LazyLayoutMeasureScopeImpl.measure-0kLqBqw(Unknown Source:33) at androidx.compose.foundation.lazy.LazyListKt$rememberLazyListMeasurePolicy$1$1$measuredItemProvider$1.getAndMeasure(Unknown Source:18) at androidx.compose.foundation.lazy.LazyListKt$rememberLazyListMeasurePolicy$1$1.invoke(Unknown Source:617) at androidx.navigation.compose.NavHostKt$NavHost$14$1.invoke(SourceFile:16) at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$createMeasurePolicy$1.measure-3p2s80s(Unknown Source:91) at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(Unknown Source:45) at androidx.compose.ui.graphics.SimpleGraphicsLayerModifier.measure-3p2s80s(Unknown Source:5) at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(Unknown Source:10) at androidx.compose.foundation.layout.PaddingNode.measure-3p2s80s(Unknown Source:37) at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(Unknown Source:10) at okhttp3.internal.http2.Http2Connection$1.invoke(SourceFile:17) at okhttp3.internal.http2.Http2Connection$1.invoke(SourceFile:13) at androidx.compose.ui.Alignment$Companion.observe(Unknown Source:63) at androidx.compose.runtime.snapshots.SnapshotStateObserver$ObservedScopeMap.observe(Unknown Source:66) at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(Unknown Source:75) at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui_release(Unknown Source:12) at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.remeasure-BRTryo0(Unknown Source:109) at androidx.compose.ui.node.MeasureAndLayoutDelegate.doRemeasure-sdFAvZA(Unknown Source:17) at androidx.compose.ui.node.MeasureAndLayoutDelegate.measureAndLayout-0kLqBqw(Unknown Source:60) at androidx.compose.ui.platform.AndroidComposeView.measureAndLayout-0kLqBqw(Unknown Source:12) at androidx.compose.ui.node.LayoutNode.forceRemeasure(Unknown Source:40) at androidx.compose.foundation.MagnifierKt$magnifier$4$3.invoke(SourceFile:27) at androidx.compose.foundation.MagnifierKt$magnifier$4$3.invoke(SourceFile:105) at androidx.compose.foundation.gestures.DefaultScrollableState$scrollScope$1.scrollBy(Unknown Source:16) at androidx.compose.runtime.RecomposeScopeImpl$end$1$2.invoke(Unknown Source:357) at androidx.compose.foundation.AndroidEdgeEffectOverscrollEffect.applyToScroll-Rhakbz0(Unknown Source:327) at androidx.compose.foundation.gestures.ScrollingLogic.dispatchScroll-3eAAhYA(Unknown Source:49) at androidx.compose.ui.ZIndexNode$measure$1.invoke(SourceFile:144) at androidx.compose.foundation.gestures.ScrollingLogic$doFlingAnimation$2$scope$1.scrollBy(Unknown Source:13) at com.jerboa.UtilsKt$border$1.invoke(SourceFile:111) at com.jerboa.UtilsKt$border$1.invoke(SourceFile:47) at kotlin.TuplesKt.doAnimationFrameWithScale(Unknown Source:64) at androidx.compose.animation.core.SuspendAnimationKt$animate$9.invoke(Unknown Source:35) at androidx.compose.foundation.layout.OffsetKt$offset$2.invoke(SourceFile:37) at androidx.compose.runtime.BroadcastFrameClock.sendFrame(Unknown Source:33) at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Unknown Source:33) at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(Unknown Source:6) at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(Unknown Source:47) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1074) at android.view.Choreographer.doCallbacks(Choreographer.java:897) at android.view.Choreographer.doFrame(Choreographer.java:822) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1061) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:236) at android.app.ActivityThread.main(ActivityThread.java:8061) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967) Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidx.compose.ui.platform.MotionDurationScaleImpl@fa11508, androidx.compose.runtime.BroadcastFrameClock@82e94a1, StandaloneCoroutine{Cancelling}@2a486c6, AndroidUiDispatcher@441e687]
json comments response

issue_comments_reponse.zip

https://programming.dev/api/v3/comment/list?max_depth=6&parent_id=1992854&type_=All&auth=REDACTED

json comments reply reponse
{"comments":[{"comment":{"id":1992854,"creator_id":238618,"post_id":1758694,"content":" How's your linux phone doing?","removed":false,"published":"2023-08-16T03:34:30.515789","deleted":false,"ap_id":"https://sh.itjust.works/comment/2229734","local":false,"path":"0.1988963.1992854","distinguished":false,"language_id":37},"creator":{"id":238618,"name":"terath","banned":false,"published":"2023-06-16T16:33:27.044229","actor_id":"https://sh.itjust.works/u/terath","local":false,"deleted":false,"admin":false,"bot_account":false,"instance_id":38},"post":{"id":1758694,"name":"Today, Reddit forcibly removed me (and everyone else) as mods of /r/iOSProgramming, a subreddit of about 130k users. I was keeping the sub private / NSFW | Tanner B 🦕🧁 (@objc@mastodon.social)","url":"https://mastodon.social/@objc/110894496445183461","body":"Update:  !ios_dev@programming.dev has been created, temporarily managed by [@Ategon@programming.dev](https://programming.dev/u/Ategon)  until some mods volunteer for it","creator_id":144032,"community_id":3,"removed":false,"locked":false,"published":"2023-08-15T20:38:03.982406","updated":"2023-08-16T02:38:13.413296","deleted":false,"nsfw":false,"embed_title":"Tanner B 🦕🧁 (@objc@mastodon.social)","embed_description":"Today, Reddit forcibly removed me (and everyone else) as mods of /r/iOSProgramming, a subreddit of about 130k users. I was keeping the sub private / NSFW to prevent Reddit from monetizing it with ads.","ap_id":"https://programming.dev/post/1758694","local":true,"language_id":0,"featured_community":false,"featured_local":false},"community":{"id":3,"name":"programming","title":"Programming","description":"Welcome to the main community in programming.dev! Feel free to post anything relating to the instance here\n\nPeople will guide you in the replies to relevant communities for that kind of content to help get you communities in the instance to then join and make future posts in\n\nWe ask that if you do a help request please add [help] to the start of the post to help differentiate it from the rest of the posts until we get a flair system in\n\nHope you enjoy the instance!","removed":false,"published":"2023-06-06T06:54:33.621165","updated":"2023-07-19T01:58:48.287900","deleted":false,"nsfw":false,"actor_id":"https://programming.dev/c/programming","local":true,"icon":"https://programming.dev/pictrs/image/8140dda6-9512-4297-ac17-d303638c90a6.png","banner":"https://programming.dev/pictrs/image/d7711fb2-cb17-41cd-b06e-a6de83db25b7.jpeg","hidden":false,"posting_restricted_to_mods":false,"instance_id":1},"counts":{"id":1749956,"comment_id":1992854,"score":9,"upvotes":15,"downvotes":6,"published":"2023-08-16T03:34:30.515789","child_count":2,"hot_rank":145},"creator_banned_from_community":false,"subscribed":"NotSubscribed","saved":false,"creator_blocked":false},{"comment":{"id":1996313,"creator_id":1792187,"post_id":1758694,"content":"You know that all Apple devices are Unix too? You're not making a point and do not know what you're talking about.","removed":false,"published":"2023-08-16T06:33:28.203248","deleted":false,"ap_id":"https://feddit.nl/comment/1927381","local":false,"path":"0.1988963.1992854.1996159.1996313","distinguished":false,"language_id":0},"creator":{"id":1792187,"name":"kattenluik","banned":false,"published":"2023-08-05T00:22:43.051906","actor_id":"https://feddit.nl/u/kattenluik","local":false,"deleted":false,"admin":false,"bot_account":false,"instance_id":34},"post":{"id":1758694,"name":"Today, Reddit forcibly removed me (and everyone else) as mods of /r/iOSProgramming, a subreddit of about 130k users. I was keeping the sub private / NSFW | Tanner B 🦕🧁 (@objc@mastodon.social)","url":"https://mastodon.social/@objc/110894496445183461","body":"Update:  !ios_dev@programming.dev has been created, temporarily managed by [@Ategon@programming.dev](https://programming.dev/u/Ategon)  until some mods volunteer for it","creator_id":144032,"community_id":3,"removed":false,"locked":false,"published":"2023-08-15T20:38:03.982406","updated":"2023-08-16T02:38:13.413296","deleted":false,"nsfw":false,"embed_title":"Tanner B 🦕🧁 (@objc@mastodon.social)","embed_description":"Today, Reddit forcibly removed me (and everyone else) as mods of /r/iOSProgramming, a subreddit of about 130k users. I was keeping the sub private / NSFW to prevent Reddit from monetizing it with ads.","ap_id":"https://programming.dev/post/1758694","local":true,"language_id":0,"featured_community":false,"featured_local":false},"community":{"id":3,"name":"programming","title":"Programming","description":"Welcome to the main community in programming.dev! Feel free to post anything relating to the instance here\n\nPeople will guide you in the replies to relevant communities for that kind of content to help get you communities in the instance to then join and make future posts in\n\nWe ask that if you do a help request please add [help] to the start of the post to help differentiate it from the rest of the posts until we get a flair system in\n\nHope you enjoy the instance!","removed":false,"published":"2023-06-06T06:54:33.621165","updated":"2023-07-19T01:58:48.287900","deleted":false,"nsfw":false,"actor_id":"https://programming.dev/c/programming","local":true,"icon":"https://programming.dev/pictrs/image/8140dda6-9512-4297-ac17-d303638c90a6.png","banner":"https://programming.dev/pictrs/image/d7711fb2-cb17-41cd-b06e-a6de83db25b7.jpeg","hidden":false,"posting_restricted_to_mods":false,"instance_id":1},"counts":{"id":1752822,"comment_id":1996313,"score":2,"upvotes":4,"downvotes":2,"published":"2023-08-16T06:33:28.203248","child_count":0,"hot_rank":167},"creator_banned_from_community":false,"subscribed":"NotSubscribed","saved":false,"creator_blocked":false}]}

I dug into this, the read more replies correctly gets the right response

but the path is for the parent comment 0.1988963.1992854 and the child comment 0.1988963.1992854.1996159.1996313

There is a comment missing there and Jerboa does not handle that properly

Neither does Lemmy UI, tried to see what they did

To Reproduce

go to this post https://programming.dev/post/1758694
find the read more replies and press it

or alternative go directly to this comment
https://programming.dev/comment/1988963

In the case of a crash or when relevant include the logs

stack trace FATAL EXCEPTION: main Process: com.jerboa, PID: 26802 java.lang.IllegalArgumentException: Key "1996313" was already used. If you are using LazyColumn/Row please make sure you provide a unique key for each item. at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$Scope.subcompose(Unknown Source:182) at androidx.compose.foundation.lazy.layout.LazyLayoutMeasureScopeImpl.measure-0kLqBqw(Unknown Source:33) at androidx.compose.foundation.lazy.LazyListKt$rememberLazyListMeasurePolicy$1$1$measuredItemProvider$1.getAndMeasure(Unknown Source:18) at androidx.compose.foundation.lazy.LazyListKt$rememberLazyListMeasurePolicy$1$1.invoke(Unknown Source:617) at androidx.navigation.compose.NavHostKt$NavHost$14$1.invoke(SourceFile:16) at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$createMeasurePolicy$1.measure-3p2s80s(Unknown Source:91) at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(Unknown Source:45) at androidx.compose.ui.graphics.SimpleGraphicsLayerModifier.measure-3p2s80s(Unknown Source:5) at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(Unknown Source:10) at androidx.compose.foundation.layout.PaddingNode.measure-3p2s80s(Unknown Source:37) at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(Unknown Source:10) at okhttp3.internal.http2.Http2Connection$1.invoke(SourceFile:17) at okhttp3.internal.http2.Http2Connection$1.invoke(SourceFile:13) at androidx.compose.ui.Alignment$Companion.observe(Unknown Source:63) at androidx.compose.runtime.snapshots.SnapshotStateObserver$ObservedScopeMap.observe(Unknown Source:66) at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(Unknown Source:75) at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui_release(Unknown Source:12) at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.remeasure-BRTryo0(Unknown Source:109) at androidx.compose.ui.node.MeasureAndLayoutDelegate.doRemeasure-sdFAvZA(Unknown Source:17) at androidx.compose.ui.node.MeasureAndLayoutDelegate.measureAndLayout-0kLqBqw(Unknown Source:60) at androidx.compose.ui.platform.AndroidComposeView.measureAndLayout-0kLqBqw(Unknown Source:12) at androidx.compose.ui.node.LayoutNode.forceRemeasure(Unknown Source:40) at androidx.compose.foundation.MagnifierKt$magnifier$4$3.invoke(SourceFile:27) at androidx.compose.foundation.MagnifierKt$magnifier$4$3.invoke(SourceFile:105) at androidx.compose.foundation.gestures.DefaultScrollableState$scrollScope$1.scrollBy(Unknown Source:16) at androidx.compose.runtime.RecomposeScopeImpl$end$1$2.invoke(Unknown Source:357) at androidx.compose.foundation.AndroidEdgeEffectOverscrollEffect.applyToScroll-Rhakbz0(Unknown Source:327) at androidx.compose.foundation.gestures.ScrollingLogic.dispatchScroll-3eAAhYA(Unknown Source:49) at androidx.compose.ui.ZIndexNode$measure$1.invoke(SourceFile:144) at androidx.compose.foundation.gestures.ScrollingLogic$doFlingAnimation$2$scope$1.scrollBy(Unknown Source:13) at com.jerboa.UtilsKt$border$1.invoke(SourceFile:111) at com.jerboa.UtilsKt$border$1.invoke(SourceFile:47) at kotlin.TuplesKt.doAnimationFrameWithScale(Unknown Source:64) at androidx.compose.animation.core.SuspendAnimationKt$animate$9.invoke(Unknown Source:35) at androidx.compose.foundation.layout.OffsetKt$offset$2.invoke(SourceFile:37) at androidx.compose.runtime.BroadcastFrameClock.sendFrame(Unknown Source:33) at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Unknown Source:33) at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(Unknown Source:6) at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(Unknown Source:47) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1074) at android.view.Choreographer.doCallbacks(Choreographer.java:897) at android.view.Choreographer.doFrame(Choreographer.java:822) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1061) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:236) at android.app.ActivityThread.main(ActivityThread.java:8061) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967) Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidx.compose.ui.platform.MotionDurationScaleImpl@fa11508, androidx.compose.runtime.BroadcastFrameClock@82e94a1, StandaloneCoroutine{Cancelling}@2a486c6, AndroidUiDispatcher@441e687]
@dessalines
Copy link
Member

I coulda swore the tree-building code should work correctly for missing comments, by just not displaying that.

But yes I think adding either a blank template for the missing comment, saying something like "couldn't find comment" works best.

@MV-GH
Copy link
Collaborator Author

MV-GH commented Aug 29, 2023

The problem is that there needs to be a node with that id, else the insertion of the comment after the missing comment goes haywire. Presumably it appends somewhere at the end. (thus when scrolling fardown enough it will crash as it loads twice teh same comment)

@dessalines
Copy link
Member

Key "1996313" was already used.

I'm not exactly sure why that key is getting re-used. Maybe using the entire path for the key would fix it?

@MV-GH
Copy link
Collaborator Author

MV-GH commented Aug 29, 2023

Because it is inserting twice the same comment because the read more replies button doesn't disappear

@dessalines
Copy link
Member

So then we need to hide that button if its been clicked once. Could be done with remember state for that comment.

@MV-GH
Copy link
Collaborator Author

MV-GH commented Aug 29, 2023

If we properly insert the comment, (by adding the template missing comment) it will remove the read more replies. Like it does for other comment trees. We don't need any special logic for this. The crash is just unintended behaviour of bad handling of comment insertion.

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
None yet
Development

Successfully merging a pull request may close this issue.

2 participants