kreonjr / omniaural

A React Global State Manager with no boilerplate
3 stars 1 forks source link

Handle period special character as a property key name #18

Closed ccreonopoulos closed 1 year ago

ccreonopoulos commented 2 years ago

When setting a property to an object that contains keys with the special "." character, OmniAural recognizes that as a key path and created a new nested property.

i.e.

initialState = {
   account: {}
}

// Somewhere in the project
OmniAural.state.account.set({
   "name":"John",
   "id.tax":"12345",
   "id.employee":"555"
})

The above will incorrectly cause the following structure to be created:

{
   account: {
       name: "John",
       id: {
           tax: "12345",
           employee: "555"
       }
   }
}

Expected structure:

{
   account: {
       name: "John",
       "id.tax": "12345",
       "id.employee": "555"
   }
}
kreonjr commented 1 year ago

Handled by https://github.com/kreonjr/omniaural/pull/23. Closing