Skip to content

fix: Handle cases where local session storage is not available#43

Merged
alexs-mparticle merged 4 commits into
developmentfrom
fix/check-local-session
Sep 8, 2025
Merged

fix: Handle cases where local session storage is not available#43
alexs-mparticle merged 4 commits into
developmentfrom
fix/check-local-session

Conversation

@alexs-mparticle
Copy link
Copy Markdown
Collaborator

@alexs-mparticle alexs-mparticle commented Sep 6, 2025

Summary

  • Handles cases where local session storage is not available
  • Exits processEvents early if there is no placementEventsMappingLookup to avoid computing hashes for matching mapped events.

Testing Plan

  • Using a sample app, remove getLocalSessionAttributes from the mParticle.Rokt namespace to verify an error is not thrown.

This comment was marked as outdated.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds defensive handling for cases where the getLocalSessionAttributes function is not available on the window.mParticle.Rokt namespace, preventing runtime errors when this optional dependency is missing.

Key changes:

  • Extracts local session attribute retrieval into a safe wrapper function with null checks
  • Adds an isEmpty utility function to check for empty values
  • Includes comprehensive test coverage for the missing function scenario

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Rokt-Kit.js Adds defensive programming with safe wrapper function and empty value checking
test/src/tests.js Adds test case to verify no errors are thrown when getLocalSessionAttributes is unavailable

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/Rokt-Kit.js
Comment thread src/Rokt-Kit.js
Comment thread src/Rokt-Kit.js
@alexs-mparticle alexs-mparticle merged commit 548cb81 into development Sep 8, 2025
4 checks passed
github-actions Bot pushed a commit that referenced this pull request Sep 8, 2025
## [1.7.2](v1.7.1...v1.7.2) (2025-09-08)

### Bug Fixes

* Handle cases where local session storage is not available ([#43](#43)) ([548cb81](548cb81))
@alexs-mparticle alexs-mparticle deleted the fix/check-local-session branch March 25, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants