Core views frontend (#13932)

Parallel code path to read and write core views when
IS_CORE_VIEW_ENABLED.

Migrated view key to an enum.

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
Raphaël Bosi
2025-08-20 19:04:58 +02:00
committed by GitHub
parent deec9c96da
commit 30c42345f0
114 changed files with 5019 additions and 254 deletions
+10 -3
View File
@@ -1,7 +1,14 @@
export const parseJson = <T>(json: string): T | null => {
import { isDefined } from "@/utils/validation";
export const parseJson = <T>(rawJson: string | boolean | null | number): T | null => {
try {
return JSON.parse(json);
if (!isDefined(rawJson)) {
return null;
}
// 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];
} catch {
return null;
return null;
}
};