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

Move Subscription Side Effect Out of Character Form Observable #225

Open
cogwizzle opened this issue Aug 16, 2022 · 0 comments
Open

Move Subscription Side Effect Out of Character Form Observable #225

cogwizzle opened this issue Aug 16, 2022 · 0 comments
Labels

Comments

@cogwizzle
Copy link
Owner

Move Subscription Side Effect Out of Character Form Observable
The Character Form Observable has a side effect in it where the observable also handles writing to a file. We should move that code into a separate subscription function. The reset code that affects localStorage should also be moved out of this file.

Acceptance Criteria
Given I have an empty CharacterFormObservable State ({})
When a notification is performed
Then the localStorage value for the character form should be cleared.

Given I CharacterFormObservable notify function is called
When the localStoragePersistenceSubscriber is notified
Then the state should be persisted to localStorage.

Describe the solution you'd like
I'd like both of these solutions to be handled in the same subscriber. If the object is empty then localStorage should be cleared. In any other circumstance then the Observable state should be persisted in localStorage.

Describe alternatives you've considered
The alternative is leaving the side effect code in the existing observable as it is today.

Additional context
N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant