Morph many to one picker (#14155)
This PR follows the multiSelect PR merged previously. It will enable morph relation Many to One to be handled from the table, using a singleSelect picker Main point : I decided to change the singleSelect API to take an array of **objectMetadataName** instead of only one to deal with both our usecases. --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { isDefined } from "@/utils/validation";
|
||||
import { isDefined } from '@/utils/validation';
|
||||
|
||||
export const parseJson = <T>(rawJson: string | boolean | null | number | undefined): T | null => {
|
||||
export const parseJson = <T>(
|
||||
rawJson: string | boolean | null | number | undefined,
|
||||
): T | null => {
|
||||
try {
|
||||
if (!isDefined(rawJson)) {
|
||||
return null;
|
||||
@@ -11,8 +13,8 @@ export const parseJson = <T>(rawJson: string | boolean | null | number | undefin
|
||||
}
|
||||
|
||||
// This is a hack to handle the case where the value is a scalar value which is part of JSON spec but not implemented before ES2019
|
||||
return JSON.parse("[" + rawJson + "]")[0];
|
||||
return JSON.parse('[' + rawJson + ']')[0];
|
||||
} catch {
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user