-
Notifications
You must be signed in to change notification settings - Fork 430
Get value from key first; if not existing, try recursive get #1383
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
Conversation
Due to splitting object field by dot (.), when an user provides a data which key has a dot, it will cause an issue for an `undefined` data which looks like not rendered. So, to solve this, we should try to get the object value from the key first. If it's not defined or null, then we will try to do the original recursive way to get value.
avindra
commented
May 27, 2020
Thanks for looking into this. It seems like the "Nested field" feature was added by @AllenFang here in response to a popular RBT 1 issue. I think Allen had the right idea to reject this nested field feature initially, as it adds more complications to this library.
The users on the original issue thread came up with a number of ways of handling this outside the table library (i.e., massage your own data), and there are certainly more ways than _.get
from lodash.
But of course this feature already went out so it would be weird to remove it now. Handling this in the getter util seems like a good fix.
I think Allen had the right idea to reject this nested field feature initially, as it adds more complications to this library.
Indeed; it's possible that adding this would make it much more difficult to debug in the future.
The users on the original issue thread came up with a number of ways of handling this outside the table library
If users find their own way to handle the data, it sounds great 👀
Handling this in the getter util seems like a good fix.
It's indeed an easy fix but I think it's fine for me to close it if @AllenFang will worry about adding more complexity to this library.
Feel free to close it if there's any concern!
thanks @CYBAI 🇹🇼 I will release it later
Due to splitting object field by dot (.), when an user provides a data
which key has a dot, it will cause an issue for an
undefined
datawhich looks like not rendered.
So, to solve this, we should try to get the object value from the key
first. If it's not defined or null, then we will try to do the original
recursive way to get value.
Fix #1381