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

Undefined behaviors #34

Open
toomim opened this issue Aug 26, 2017 · 0 comments
Open

Undefined behaviors #34

toomim opened this issue Aug 26, 2017 · 0 comments

Comments

@toomim
Copy link
Member

toomim commented Aug 26, 2017

Undefined fields

Statebus hasn't decided whether undefined fields should be stripped out of objects, or preserved. As a consequence, it behaves inconsistently. Here's an example:

save({key: 'a'})
save({key: 'a', a: undefined})
bus.cache.a  // ==> {key: 'a'}
save({key: 'b', b: undefined})
bus.cache.b  // ==> {key: 'a', b: undefined}

We need to decide what to do with undefined fields, and sweep through the whole codebase to enforce it.

Zero-length keys

Statebus will often not recognize the '' key:

{key: '', ...}

Because '' evaluates to false, and quite a bit of code checks if an object has a key with obj.key.

@toomim toomim changed the title Undefined's behavior is undefined Undefined behaviors Aug 26, 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

No branches or pull requests

1 participant