Describe the bug
When startMonitoring is called in JSRefreshRateMonitor, an existing JSRefreshRateListener is not properly invalidated before a new one is created. This means each time startMonitoring is called, more listeners are being created.
Reproduction steps
We use Electrode miniapps meaning it is common for us to create and destroy new miniapps. Each time a new miniapp is created, more refresh monitors are created in memory, that will stay behind even as the miniapps are destroyed.
To give a toy example:
let appCount = 200
for i in Range(1...appCount) {
let _ = ElectrodeReactNative
.sharedInstance()
.miniApp(
withName: "some_name",
properties: properties,
overlay: false,
sizeFlexibility: RCTRootViewSizeFlexibility.none.rawValue,
delegate: nil
)
}
Here we create 200 miniapps. we do not store them anywhere, so we should expect that no additional memory should be used. However, if we check the memory graph, we will see that 200 additional refresh rate listeners are still in memory.

SDK logs
No response
Expected behavior
No response
Affected SDK versions
2.1.0
Latest working SDK version
N/A
Did you confirm if the latest SDK version fixes the bug?
Yes
Integration Methods
Yarn
React Native Version
No response
Package.json Contents
No response
iOS Setup
No response
Android Setup
No response
Device Information
No response
Other relevant information
No response
Describe the bug
When
startMonitoringis called inJSRefreshRateMonitor, an existingJSRefreshRateListeneris not properly invalidated before a new one is created. This means each timestartMonitoringis called, more listeners are being created.Reproduction steps
We use Electrode miniapps meaning it is common for us to create and destroy new miniapps. Each time a new miniapp is created, more refresh monitors are created in memory, that will stay behind even as the miniapps are destroyed.
To give a toy example:
Here we create 200 miniapps. we do not store them anywhere, so we should expect that no additional memory should be used. However, if we check the memory graph, we will see that 200 additional refresh rate listeners are still in memory.

SDK logs
No response
Expected behavior
No response
Affected SDK versions
2.1.0
Latest working SDK version
N/A
Did you confirm if the latest SDK version fixes the bug?
Yes
Integration Methods
Yarn
React Native Version
No response
Package.json Contents
No response
iOS Setup
No response
Android Setup
No response
Device Information
No response
Other relevant information
No response