Browse Source

fix: PR review changes #2240

pull/7528/head
Ramesh Mane 11 months ago
parent
commit
7acb5a46d0
  1. 4
      packages/nc-gui/store/bases.ts
  2. 7
      packages/nocodb/src/models/Base.ts
  3. 36
      packages/nocodb/src/models/BaseUser.ts

4
packages/nc-gui/store/bases.ts

@ -309,7 +309,7 @@ export const useBases = defineStore('basesStore', () => {
const basesArray = Array.from(bases.value.values())
let baseOrderSet = new Set()
const baseOrderSet = new Set()
let hasNullOrDuplicates = false
// Check if basesArray contains null or duplicate order
@ -324,7 +324,7 @@ export const useBases = defineStore('basesStore', () => {
if (!hasNullOrDuplicates) return
// update the local state and return updated bases payload
let updatedBasesOrder = basesArray.map((base, i) => {
const updatedBasesOrder = basesArray.map((base, i) => {
bases.value.set(base.id!, { ...base, order: i + 1 })
return {

7
packages/nocodb/src/models/Base.ts

@ -123,7 +123,7 @@ export default class Base implements BaseType {
await NocoCache.setList(CacheScope.PROJECT, [], baseList);
}
baseList = baseList
const castedProjectList = baseList
.filter(
(p) => p.deleted === 0 || p.deleted === false || p.deleted === null,
)
@ -131,9 +131,8 @@ export default class Base implements BaseType {
(a, b) =>
(a.order != null ? a.order : Infinity) -
(b.order != null ? b.order : Infinity),
);
const castedProjectList = baseList.map((m) => this.castType(m));
)
.map((m) => this.castType(m));
await Promise.all(castedProjectList.map((base) => base.getSources(ncMeta)));

36
packages/nocodb/src/models/BaseUser.ts

@ -352,25 +352,27 @@ export default class BaseUser {
qb.whereNot(`${MetaTable.PROJECT}.deleted`, true);
const baseList = await qb;
if (baseList?.length) {
// parse meta
for (const base of baseList) {
base.meta = parseMetaProp(base);
}
}
const castedProjectList = baseList
.filter((p) => !params?.type || p.type === params.type)
.sort(
(a, b) =>
(a.order != null ? a.order : Infinity) -
(b.order != null ? b.order : Infinity),
)
.map((m) => Base.castType(m));
await Promise.all(castedProjectList.map((base) => base.getSources(ncMeta)));
if (baseList && baseList?.length) {
const castedProjectList = baseList
.filter((p) => !params?.type || p.type === params.type)
.sort(
(a, b) =>
(a.order != null ? a.order : Infinity) -
(b.order != null ? b.order : Infinity),
)
.map((m) => {
m.meta = parseMetaProp(m);
return Base.castType(m);
});
return castedProjectList;
await Promise.all(
castedProjectList.map((base) => base.getSources(ncMeta)),
);
return castedProjectList;
} else {
return [];
}
}
static async updateOrInsert(

Loading…
Cancel
Save