-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Description
Is there an existing issue for this?
- I have searched the existing issues
SDK Version
6.1.0
Current Behavior
When having pages restored from B/f Cache, the BatchEventProcessor
stops sending events to the endpoints. This causes a gap in data.
Expected Behavior
Events should continue being send.
Steps To Reproduce
- Create an application with a simple setup as described in Optimizely Docs
- Send events permanently and monitor the events endpoint
- Use Chromes
Application > Back/forward cache > Test b/f cache
button to simulate page restore - Verify that events are not send anymore
Link to video demonstrating the issue
SDK Type
Browser
Node Version
24.9.0
Browsers impacted
At least Chrome
Link
import './style.css';
import { createInstance, createPollingProjectConfigManager, createBatchEventProcessor } from '@optimizely/optimizely-sdk';
const testingClient = createInstance({
projectConfigManager: createPollingProjectConfigManager({
sdkKey: {SDK_KEY},
updateInterval: 20000,
autoUpdate: true
}),
eventProcessor: createBatchEventProcessor({
batchSize: 1,
flushInterval: 1000
}),
});
testingClient.onReady().then(() => {
setInterval(() => {
testingClient.track('search_dom_interactive_ms', '123');
}, 3000);
});
Logs
No response
Severity
No response
Workaround/Solution
Very suboptimal hack to set the state to running (using private properties and is super error prone). Also it seems that this solution does not work in all cases because numbers are still lower than without B/f cache enabled.
window.addEventListener('pageshow', (event) => {
if (event.persisted) {
client.eventProcessor.state = 2;
}
});
Recent Change
No response
Conflicts
No response