mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 13:06:31 +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 { useFieldSchema } from '@formily/react';
|
||||||
import { forEach, showToast } from '@nocobase/utils/client';
|
import { error, forEach, showToast } from '@nocobase/utils/client';
|
||||||
import { Select } from 'antd';
|
import { Select } from 'antd';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import React, { useCallback, useEffect } from 'react';
|
import React, { useCallback, useEffect } from 'react';
|
||||||
@ -29,6 +29,7 @@ const useDataTemplates = () => {
|
|||||||
|
|
||||||
// 过滤掉已经被删除的字段
|
// 过滤掉已经被删除的字段
|
||||||
items.forEach((item) => {
|
items.forEach((item) => {
|
||||||
|
try {
|
||||||
item.fields = item.fields
|
item.fields = item.fields
|
||||||
.map((field) => {
|
.map((field) => {
|
||||||
const joinField = getCollectionJoinField(`${item.collection}.${field}`);
|
const joinField = getCollectionJoinField(`${item.collection}.${field}`);
|
||||||
@ -38,6 +39,10 @@ const useDataTemplates = () => {
|
|||||||
return '';
|
return '';
|
||||||
})
|
})
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
|
} catch (err) {
|
||||||
|
error(err);
|
||||||
|
item.fields = [];
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const templates: any = [
|
const templates: any = [
|
||||||
|
@ -4,6 +4,7 @@ export * from './date';
|
|||||||
export * from './forEach';
|
export * from './forEach';
|
||||||
export * from './getValuesByPath';
|
export * from './getValuesByPath';
|
||||||
export * from './json-templates';
|
export * from './json-templates';
|
||||||
|
export * from './log';
|
||||||
export * from './merge';
|
export * from './merge';
|
||||||
export * from './notification';
|
export * from './notification';
|
||||||
export * from './number';
|
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