fix: Handle cases where local session storage is not available#43
Merged
Conversation
Contributor
There was a problem hiding this comment.
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
isEmptyutility 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.
rmi22186
requested changes
Sep 6, 2025
rmi22186
approved these changes
Sep 6, 2025
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))
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
processEventsearly if there is noplacementEventsMappingLookupto avoid computing hashes for matching mapped events.Testing Plan
getLocalSessionAttributesfrom the mParticle.Rokt namespace to verify an error is not thrown.