Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private _onPlatformChanged = (platformKey: TPlatforms): void => {
const { siteDefinition } = this.props;
if (platformKey !== this.state.platform) {
trackEvent(EventNames.ChangedPlatform, {
topic: getSiteArea(siteDefinition.pages), // @TODO: Remove topic when data is stale.
currentArea: getSiteArea(siteDefinition.pages),
platform: platformKey, // @TODO: Remove platform when data is stale.
currentPlatform: this.state.platform,
nextPlatform: platformKey
});
const { activePlatforms } = this.state;
const currentPage = getSiteArea(siteDefinition.pages);
this.setState(
{
platform: platformKey,
activePlatforms: {
...activePlatforms,
[currentPage]: platformKey