simpla
simpla copied to clipboard
Implicitly created hierarchies should hydrate from API
Scenario
Calling Simpla.set('foo.bar.baz', { ... })
, before having calling set
/ get
on either ancestor foo
or foo.bar
, may result in incorrect data being stored in the buffer for foo
and foo.bar
- meaning that calling Simpla.get
on either may return incorrect data.
Expected behaviour
Calling Simpla.get('foo.bar')
will always respond with the data previously saved and stored remotely, or, data that's been explicitly set locally via Simpla.set('foo.bar')
Actual behaviour
Simpla.get('foo.bar')
may return blank data, even though data has been set to the API.
Analysis
Calling Simpla.set('foo.bar.baz', { ... })
will cause the SDK to ensure that foo
and foo.bar
exist in the buffer, even if just blank - to replicate the functionality of the remote API. Instead, if it doesn't exist in the buffer, it should check if it doesn't exist in the remote API, then should set blank data iff it doesn't exist there.