xh / hoist-react

🏗️ ⚛️ The XH Hoist toolkit for React
https://xh.io
Apache License 2.0
24 stars 8 forks source link

Review / improve support for dot-delimited field paths in `Store` + data package #2886

Open febbraiod opened 2 years ago

febbraiod commented 2 years ago

When using a dot separated field path to specify a field on a column, it must be specified using the string form of the field:

field: 'levelOne.nestedField'

Using a a config for a typed store field as a dot-separated path causes the value in the column to be null:

field: {name: 'levelOne.nestedField', type: FieldType.NUMBER}

TomTirapani commented 2 years ago

I took a look at this, and opened a PR to resolve here:

https://github.com/xh/hoist-react/pull/2890

The above PR allows the store to created the field the same as if it was defined using the string form. However, it should be noted that neither will create a typed store field. Dot-delimited fields are always handled in the store as untyped root fields (i.e. in the above example, what you actually end up with on the store is a levelOne field of type AUTO). This means that there's currently no way to provide a type to nestedField. I think addressing that is beyond the scope of this ticket, just something to be aware of as it may lead to unexpected behaviour throughout the app.

lbwexler commented 2 years ago

RE-opening this and reverting the merge after discussion with Tom. We did not want to merge this as we think it really is not helpful to just ignore the user specified type quietly. Reopening ticket for a more expansive discussion