Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a new SDK instance for new widgets #152

Merged
merged 3 commits into from
Jul 12, 2017
Merged

Conversation

laander
Copy link
Contributor

@laander laander commented Jul 11, 2017

Motivation

There's an leaking issue when using multiple instances of the library on the same page, where config settings differ (app, user auth etc). The reason is that when the JS SDK is getting required through DI, a singleton is always returned which means that multiple widgets still refer to the same SDK instance and thus overwrites each other config settings.

This PR makes sure that a new SDK instance is created for each new widget to keep config and state isolated from each other.

Design choices

Depends on a new newInstance method on the SDK. Chose this path instead of creating the default behaviour of the SDK in order to keep backwards compatibility.

Tests

Added one test.

Release dependencies

timekit-io/js-sdk#31

Who should review it

@Trolzie

@Trolzie
Copy link
Contributor

Trolzie commented Jul 12, 2017

when build are green ♠️

@laander laander merged commit ecd57f0 into master Jul 12, 2017
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.

2 participants