mirror of
https://github.com/johndoe6345789/low-code-react-app-b.git
synced 2026-04-24 21:54:56 +00:00
Add safety checks to compute functions and schema loader
Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
@@ -25,9 +25,9 @@ export const computeAddTodo = (data: any) => ({
|
||||
completed: false,
|
||||
})
|
||||
|
||||
export const updateFilterQuery = (_: any, event: any) => event.target.value
|
||||
export const updateFilterQuery = (_: any, event: any) => event?.target?.value || ''
|
||||
|
||||
export const updateNewTodo = (data: any, event: any) => event.target.value
|
||||
export const updateNewTodo = (data: any, event: any) => event?.target?.value || ''
|
||||
|
||||
export const checkCanAddTodo = (data: any) => data.newTodo?.trim().length > 0
|
||||
|
||||
|
||||
@@ -4,6 +4,15 @@ import * as computeFunctions from './compute-functions'
|
||||
type ComputeFunctionMap = typeof computeFunctions
|
||||
|
||||
export function hydrateSchema(jsonSchema: any): PageSchema {
|
||||
// Validate basic schema structure
|
||||
if (!jsonSchema || typeof jsonSchema !== 'object') {
|
||||
throw new Error('Invalid schema: expected an object')
|
||||
}
|
||||
|
||||
if (!jsonSchema.id || !jsonSchema.name) {
|
||||
console.warn('Schema missing required fields: id and name')
|
||||
}
|
||||
|
||||
const schema = { ...jsonSchema }
|
||||
|
||||
if (schema.dataSources) {
|
||||
|
||||
Reference in New Issue
Block a user