diff --git a/formula/src/main/java/com/instacart/formula/internal/SnapshotImpl.kt b/formula/src/main/java/com/instacart/formula/internal/SnapshotImpl.kt index 71f6e81a..8f7e5ddd 100644 --- a/formula/src/main/java/com/instacart/formula/internal/SnapshotImpl.kt +++ b/formula/src/main/java/com/instacart/formula/internal/SnapshotImpl.kt @@ -60,6 +60,11 @@ internal class SnapshotImpl internal constructor( } override fun createScopedKey(type: KClass<*>, key: Any?): Any { + if (scopeKey == null && key == null) { + // No need to allocate a new object, just use type as key. + return type + } + return FormulaKey( scopeKey = scopeKey, type = type,