Closed mgroth0 closed 1 year ago
Maybe related to https://github.com/google/accompanist/issues/847, but not sure because the number reported in the error message 355113
is much smaller.
Also might be related to https://stackoverflow.com/questions/71400647/cant-represent-a-size-of-214748364-in-constraints, but again the number here is much smaller
Also https://github.com/JetBrains/compose-multiplatform/issues/2420, again this one had a larger number
The repro can be simplified to this:
val constraints = Constraints.fixedWidth(width = 355113)
This error has to do with an algorithm of how Compose packs Constraints input values bits. Apparently, it's too much for what was considered by Google to be a sane value, so they explicitly throw an exception in this case.
Unfortunately, we don't own this piece of logic. So if you think it's something that needs a change for some specific (and should I notice, extreme) scenarios, you can make a report on Google Tracker.
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.
Describe the bug
Creating a large
Text
in a scrollable container causes this error.Affected platforms
Versions
To Reproduce
scroll
at the top of the code is trueExpected behavior
I am pushing the limits of what can be handled with huge amounts of text like this, so it is not surprising that I will run into errors. However, this error in particular is not very informative on what caused the issue, or how to solve it. "Can't represent a size of 355113 in Constraints" is only helpful to internally to the developers of the library itself, since users (in this case) are not directly working with
Constraints
. ifConstraints
is supposed to be abstracted away by the comonents used in the reproducers, then a more user-friendly error message sould be thrown.Given the vagueness of the error message, I am not exactly sure what I did "wrong". Was it wrong of me to use so much text? or did I implement scrolling wrong somehow? Or should i have broken the text up into multiple comonents? Or used some sort of lazy view? It is unclear.
So basically, the question is whether this is user error or not. If it is user error, a more friendly, informative, actionable error message should be thrown. If it is not user error, then the bug itself can be fixed.
Additional context
I am working on a simple log viewer, and this started happening to me with large amounts of text in a single log. I think I am probably doing it wrong, but this error is not helpful in pointing me in the right direction.