fix: 避免 table/nav 里数据 id 不一致导致页面报错,将之前的 id 换成更不容易冲突的 __id 字段 (#3731)

This commit is contained in:
吴多益 2022-03-09 19:56:03 +08:00 committed by GitHub
parent 2dd7772ffb
commit 838d741764
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 41 additions and 41 deletions

View File

@ -5,7 +5,7 @@ export default [
platform: 'Win 95+',
version: '4',
grade: 'A',
id: 1
__id: 1
},
{
engine: 'Trident',
@ -13,7 +13,7 @@ export default [
platform: 'Win 95+',
version: '4',
grade: 'B',
id: 2
__id: 2
},
{
engine: 'Trident',
@ -21,7 +21,7 @@ export default [
platform: 'Win 95+',
version: '4',
grade: 'C',
id: 3
__id: 3
},
{
engine: 'Trident',
@ -29,7 +29,7 @@ export default [
platform: 'Win 98',
version: '3',
grade: 'A',
id: 4
__id: 4
},
{
engine: 'Trident',
@ -37,7 +37,7 @@ export default [
platform: 'Win 98',
version: '4',
grade: 'A',
id: 5
__id: 5
},
{
engine: 'Gecko',
@ -45,7 +45,7 @@ export default [
platform: 'Win 98+ / OSX.2+',
version: '4',
grade: 'A',
id: 6
__id: 6
},
{
engine: 'Gecko',
@ -53,7 +53,7 @@ export default [
platform: 'Win 98+ / OSX.2+',
version: '5',
grade: 'A',
id: 7
__id: 7
},
{
engine: 'Gecko',
@ -61,7 +61,7 @@ export default [
platform: 'Win 98+ / OSX.2+',
version: '5',
grade: 'B',
id: 8
__id: 8
},
{
engine: 'Gecko',
@ -69,7 +69,7 @@ export default [
platform: 'Win 98+ / OSX.2+',
version: '5',
grade: 'C',
id: 9
__id: 9
},
{
engine: 'Gecko',
@ -77,6 +77,6 @@ export default [
platform: 'Win 98+ / OSX.2+',
version: '5',
grade: 'D',
id: 10
__id: 10
}
];

View File

@ -16,7 +16,7 @@ test('Renderer:crud', async () => {
syncLocation: false,
columns: [
{
name: 'id',
name: '__id',
label: 'ID'
},
{

View File

@ -20,28 +20,28 @@ test('Renderer:nav', () => {
},
links: [
{
id: 0,
__id: 0,
label: 'Nav 1',
to: '/docs/index',
icon: 'https://suda.cdn.bcebos.com/images%2F2021-01%2Fdiamond.svg',
active: true
},
{
id: 1,
__id: 1,
label: 'Nav 2',
to: '/docs/api',
customText: 'HOT',
customLevel: 'danger'
},
{
id: 2,
__id: 2,
label: 'Nav 3',
to: '/docs/renderers',
customText: 'SUC',
customLevel: 'success'
},
{
id: 3,
__id: 3,
label: '外部地址',
to: 'http://www.baidu.com/',
target: '_blank'

View File

@ -138,7 +138,7 @@ test('Renderer:table children', () => {
platform: 'Win 95+',
version: '4',
grade: 'X',
id: 1,
__id: 1,
children: [
{
engine: 'Trident',
@ -146,7 +146,7 @@ test('Renderer:table children', () => {
platform: 'Win 95+',
version: '4',
grade: 'X',
id: 1001
__id: 1001
},
{
engine: 'Trident',
@ -154,7 +154,7 @@ test('Renderer:table children', () => {
platform: 'Win 95+',
version: '5',
grade: 'C',
id: 1002
__id: 1002
}
]
},
@ -164,7 +164,7 @@ test('Renderer:table children', () => {
platform: 'Win 95+',
version: '5',
grade: 'C',
id: 2,
__id: 2,
children: [
{
engine: 'Trident',
@ -172,7 +172,7 @@ test('Renderer:table children', () => {
platform: 'Win 95+',
version: '4',
grade: 'X',
id: 2001
__id: 2001
},
{
engine: 'Trident',
@ -180,7 +180,7 @@ test('Renderer:table children', () => {
platform: 'Win 95+',
version: '5',
grade: 'C',
id: 2002
__id: 2002
}
]
},
@ -190,7 +190,7 @@ test('Renderer:table children', () => {
platform: 'Win 95+',
version: '5.5',
grade: 'A',
id: 3,
__id: 3,
children: [
{
engine: 'Trident',
@ -198,7 +198,7 @@ test('Renderer:table children', () => {
platform: 'Win 95+',
version: '4',
grade: 'X',
id: 3001
__id: 3001
},
{
engine: 'Trident',
@ -206,7 +206,7 @@ test('Renderer:table children', () => {
platform: 'Win 95+',
version: '5',
grade: 'C',
id: 3002
__id: 3002
}
]
},
@ -216,7 +216,7 @@ test('Renderer:table children', () => {
platform: 'Win 98+',
version: '6',
grade: 'A',
id: 4,
__id: 4,
children: [
{
engine: 'Trident',
@ -224,7 +224,7 @@ test('Renderer:table children', () => {
platform: 'Win 95+',
version: '4',
grade: 'X',
id: 4001
__id: 4001
},
{
engine: 'Trident',
@ -232,7 +232,7 @@ test('Renderer:table children', () => {
platform: 'Win 95+',
version: '5',
grade: 'C',
id: 4002
__id: 4002
}
]
},
@ -242,7 +242,7 @@ test('Renderer:table children', () => {
platform: 'Win XP SP2+',
version: '7',
grade: 'A',
id: 5,
__id: 5,
children: [
{
engine: 'Trident',
@ -250,7 +250,7 @@ test('Renderer:table children', () => {
platform: 'Win 95+',
version: '4',
grade: 'X',
id: 5001
__id: 5001
},
{
engine: 'Trident',
@ -258,7 +258,7 @@ test('Renderer:table children', () => {
platform: 'Win 95+',
version: '5',
grade: 'C',
id: 5002
__id: 5002
}
]
}
@ -288,7 +288,7 @@ test('Renderer:table children', () => {
label: 'Browser'
},
{
name: 'id',
name: '__id',
label: 'ID'
},
{
@ -398,7 +398,7 @@ test('Renderer:table list', () => {
data: {
items: [
{
id: '91264',
__id: '91264',
text: '衡 阎',
progress: 22,
type: 4,
@ -439,12 +439,12 @@ test('Renderer:table list', () => {
image:
'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3893101144,2877209892&fm=23&gp=0.jpg',
json: {
id: 1,
__id: 1,
text: 'text'
}
},
{
id: '34202',
__id: '34202',
text: '吉 卢汉市',
progress: 85,
type: 1,
@ -509,12 +509,12 @@ test('Renderer:table list', () => {
image:
'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3893101144,2877209892&fm=23&gp=0.jpg',
json: {
id: 1,
__id: 1,
text: 'text'
}
},
{
id: '37701',
__id: '37701',
text: '立辉安市',
progress: 72,
type: 2,
@ -571,7 +571,7 @@ test('Renderer:table list', () => {
image:
'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3893101144,2877209892&fm=23&gp=0.jpg',
json: {
id: 1,
__id: 1,
text: 'text'
}
}
@ -581,7 +581,7 @@ test('Renderer:table list', () => {
syncLocation: false,
columns: [
{
name: 'id',
name: '__id',
label: 'ID',
type: 'text'
},

View File

@ -523,7 +523,7 @@ const ConditionBuilderWithRemoteOptions = withRemoteConfig({
env &&
env.isCurrentUrl(filter(link.to as string, data))
)),
__id: link.id ?? link.__id ?? guid()
__id: link.__id ?? guid()
};
item.unfolded =

View File

@ -899,7 +899,7 @@ export const TableStore = iRendererStore
: {
item
};
const id = item.id ?? guid();
const id = item.__id ?? guid();
return {
// id: String(item && (item as any)[self.primaryField] || `${pindex}-${depth}-${key}`),
@ -941,7 +941,7 @@ export const TableStore = iRendererStore
let arr: Array<SRow> = rows.map((item, index) => {
let id = String(
getEntryId ? getEntryId(item, index) : item.id ?? guid()
getEntryId ? getEntryId(item, index) : item.__id ?? guid()
);
return {
// id: getEntryId ? getEntryId(item, key) : String(item && (item as any)[self.primaryField] || `${key}-1-${key}`),