Fix isolation issue for shared state extension with key path #12
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.
Delete SharedStateKey and SharedStateValues due to isolation issue. The previous implementation was based on single source of truth, but every variable was setting on or getting from SharedStateKey.currentValue, this might cause problems when you have more than one box and meanwhile you reuse the keys.
Modification is delete SharedStateKey and SharedStateValues completely, every shared state extension owns a separated stateValue, during its initialization phase developer needs to assign your instance of state to shared state extension. Developers do not need to extend SharedStateValues or define your SharedStateKey anymore, just provide an instance of your custom state value.
The rest part is still follow this PR, with same APIs, only one difference is you need to point out type for your key paths as below: