mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 10:37:01 +00:00
fix(Data-templates): avoid errors and add log
This commit is contained in:
parent
58fda41513
commit
a0dd58e7e3
@ -1,5 +1,5 @@
|
||||
import { useFieldSchema } from '@formily/react';
|
||||
import { forEach, showToast } from '@nocobase/utils/client';
|
||||
import { error, forEach, showToast } from '@nocobase/utils/client';
|
||||
import { Select } from 'antd';
|
||||
import _ from 'lodash';
|
||||
import React, { useCallback, useEffect } from 'react';
|
||||
@ -29,6 +29,7 @@ const useDataTemplates = () => {
|
||||
|
||||
// 过滤掉已经被删除的字段
|
||||
items.forEach((item) => {
|
||||
try {
|
||||
item.fields = item.fields
|
||||
.map((field) => {
|
||||
const joinField = getCollectionJoinField(`${item.collection}.${field}`);
|
||||
@ -38,6 +39,10 @@ const useDataTemplates = () => {
|
||||
return '';
|
||||
})
|
||||
.filter(Boolean);
|
||||
} catch (err) {
|
||||
error(err);
|
||||
item.fields = [];
|
||||
}
|
||||
});
|
||||
|
||||
const templates: any = [
|
||||
|
@ -4,6 +4,7 @@ export * from './date';
|
||||
export * from './forEach';
|
||||
export * from './getValuesByPath';
|
||||
export * from './json-templates';
|
||||
export * from './log';
|
||||
export * from './merge';
|
||||
export * from './notification';
|
||||
export * from './number';
|
||||
|
3
packages/core/utils/src/log.ts
Normal file
3
packages/core/utils/src/log.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export const error = (message: Error | string, ...args: any[]) => {
|
||||
console.error(message, ...args);
|
||||
};
|
Loading…
Reference in New Issue
Block a user