refactor: target key (#6000)

This commit is contained in:
Katherine 2025-01-06 21:11:09 +08:00 committed by GitHub
parent 91a998fff8
commit 648e282d48
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 12 deletions

View File

@ -171,10 +171,10 @@ export const TargetKey = observer(
setOptions(
getCollection(target)
.fields?.filter((v) => {
if (type !== 'hasMany') {
return v.primaryKey || v.unique;
if (v.primaryKey || v.unique) {
return true;
}
return supportTypes.includes(v.type);
return type === 'hasMany' && supportTypes.includes(v.type);
})
.map((k) => {
return {
@ -196,10 +196,10 @@ export const TargetKey = observer(
setOptions(
getCollection(target)
.fields?.filter((v) => {
if (type !== 'hasMany') {
return v.primaryKey || v.unique;
if (v.primaryKey || v.unique) {
return true;
}
return supportTypes.includes(v.type);
return type === 'hasMany' && supportTypes.includes(v.type);
})
.map((k) => {
return {

View File

@ -161,10 +161,10 @@ export const TargetKey = observer(
setOptions(
getCollection(target, dataSourceKey)
.fields?.filter((v) => {
if (type !== 'hasMany') {
return v.primaryKey || v.unique;
if (v.primaryKey || v.unique) {
return true;
}
return supportTypes.includes(v.type);
return type === 'hasMany' && supportTypes.includes(v.type);
})
.map((k) => {
return {
@ -196,10 +196,10 @@ export const TargetKey = observer(
setOptions(
data.data
?.filter((v) => {
if (type !== 'hasMany') {
return v.primaryKey || v.unique;
if (v.primaryKey || v.unique) {
return true;
}
return supportTypes.includes(v.type);
return type === 'hasMany' && supportTypes.includes(v.type);
})
.map((k) => {
return {