Skip to content

docs: explain intentional CartSummary instability#85

Open
himattm wants to merge 1 commit into
mainfrom
chore/explain-cartsummary-intent
Open

docs: explain intentional CartSummary instability#85
himattm wants to merge 1 commit into
mainfrom
chore/explain-cartsummary-intent

Conversation

@himattm
Copy link
Copy Markdown
Owner

@himattm himattm commented May 8, 2026

Summary

  • Clarifies that CartSummary is intentionally not a data class in the demo
  • Explains that the unstable identity-equality behavior is a fixture for Dejavu's recomposition detection examples/tests
  • Tells automated agents not to optimize the sample by converting it to a data class

Test Plan

  • JAVA_HOME=/opt/homebrew/opt/openjdk@21/libexec/openjdk.jdk/Contents/Home ./gradlew -q --console=plain :dejavu:jvmTest :dejavu:testDebugUnitTest apiCheck
  • JAVA_HOME=/opt/homebrew/opt/openjdk@21/libexec/openjdk.jdk/Contents/Home ./gradlew -q --console=plain :dejavu:iosSimulatorArm64Test :dejavu:wasmJsBrowserTest

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the documentation comments for the CartSummary class in ProductList.kt to clarify that its lack of structural equality is intentional for testing the Dejavu library. The review feedback suggests using more idiomatic Kotlin Multiplatform terminology, such as referencing Any.equals() instead of Object.equals(), and refining the description of Compose recomposition behavior.

Comment on lines +50 to +51
// INTENTIONAL: regular class with identity-based equality (Object.equals).
// Keeping this unstable is part of the demo/test fixture; changing it to a
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

In Kotlin Multiplatform (commonMain), it is more idiomatic to refer to Any.equals() or "referential equality" rather than the JVM-specific Object.equals(). Additionally, since all properties are val and of stable types, this class is technically "Stable" in Compose terms; the recompositions occur due to the lack of structural equality, not type instability. Using "behavior" or "identity equality" instead of "unstable" avoids confusion with the Compose compiler's stability system.

Suggested change
// INTENTIONAL: regular class with identity-based equality (Object.equals).
// Keeping this unstable is part of the demo/test fixture; changing it to a
// INTENTIONAL: regular class with identity-based equality (Any.equals).
// Keeping this behavior is part of the demo/test fixture; changing it to a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant