Remove Node id default impl

Summary: This is never identity hash code for declarative framework so this default impl is just a source of bugs, including this one.

Reviewed By: lblasa

Differential Revision: D47754625

fbshipit-source-id: 470aab084c82fa847f25116342021a79d52b7c67
This commit is contained in:
Luke De Feo
2023-07-26 04:58:43 -07:00
committed by Facebook GitHub Bot
parent 6b1da22a26
commit 60016e69f5
5 changed files with 12 additions and 1 deletions

View File

@@ -26,6 +26,8 @@ import com.facebook.flipper.plugins.uidebugger.util.MaybeDeferred
abstract class ChainedDescriptor<T> : NodeDescriptor<T> {
private var mSuper: ChainedDescriptor<T>? = null
override fun getId(node: T): Id = System.identityHashCode(node)
fun setSuper(superDescriptor: ChainedDescriptor<T>) {
if (superDescriptor !== mSuper) {
check(mSuper == null)

View File

@@ -38,7 +38,7 @@ typealias Id = Int
interface NodeDescriptor<T> {
/** Used to detect the same node across traversals */
fun getId(node: T): Id = System.identityHashCode(node)
fun getId(node: T): Id
/** Should be w.r.t the direct parent */
fun getBounds(node: T): Bounds

View File

@@ -15,6 +15,8 @@ import com.facebook.flipper.plugins.uidebugger.util.Immediate
object ObjectDescriptor : NodeDescriptor<Any> {
override fun getId(node: Any): Id = System.identityHashCode(node)
override fun getActiveChild(node: Any): Any? = null
override fun getName(node: Any): String {