[FSSDK-11510] refactor unsupported factories to not throw#1056
Merged
[FSSDK-11510] refactor unsupported factories to not throw#1056
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors unsupported factories so they now return undefined instead of throwing errors, making it easier to write isomorphic apps.
- Updated VuidManager extraction and wrapping functions to use the Maybe type.
- Modified platform-specific factories (Node, React Native, Browser) to return undefined for unsupported operations.
- Adjusted tests and type definitions to verify the new behavior.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/vuid/vuid_manager_factory.ts | Updated extract and wrap functions to use Maybe for unsupported cases. |
| lib/vuid/vuid_manager_factory.node.ts | Changed createVuidManager to return an undefined-wrapped value instead of throwing an error. |
| lib/vuid/vuid_manager_factory.node.spec.ts | Updated tests to assert that an undefined value is returned. |
| lib/vuid/vuid_manager_factory.browser.spec.ts | Updated describe block naming to reflect the change in behavior. |
| lib/index.react_native.ts | Modified getSendBeaconEventDispatcher to return undefined instead of throwing an error. |
| lib/index.node.ts | Modified getSendBeaconEventDispatcher to return undefined. |
| lib/index.browser.ts | Updated getSendBeaconEventDispatcher signature to include undefined. |
| lib/entrypoint.test-d.ts | Adjusted the type of getSendBeaconEventDispatcher to return a Maybe. |
junaed-optimizely
approved these changes
May 16, 2025
Contributor
junaed-optimizely
left a comment
There was a problem hiding this comment.
LGTM! Nice improvement!
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
Test plan
Issues