Browse Source

fix(nocodb): bulk delete custom url

Ramesh Mane 16 hours ago
parent
commit
1ed301e569
  1. 4
      packages/nocodb/src/models/Base.ts
  2. 6
      packages/nocodb/src/models/Model.ts
  3. 10
      packages/nocodb/src/models/View.ts

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

@ -307,6 +307,10 @@ export default class Base implements BaseType {
CacheDelDirection.CHILD_TO_PARENT,
);
CustomUrl.bulkDelete({ base_id: baseId }, ncMeta).catch(() => {
logger.error(`Failed to delete custom urls of baseId: ${baseId}`);
});
cleanCommandPaletteCache(context.workspace_id).catch(() => {
logger.error('Failed to clean command palette cache');
});

6
packages/nocodb/src/models/Model.ts

@ -27,7 +27,7 @@ import {
import NocoCache from '~/cache/NocoCache';
import Noco from '~/Noco';
import { BaseModelSqlv2 } from '~/db/BaseModelSqlv2';
import { CustomUrl, FileReference } from '~/models';
import { FileReference } from '~/models';
import { cleanCommandPaletteCache } from '~/helpers/commandPaletteHelpers';
import {
parseMetaProp,
@ -645,10 +645,6 @@ export default class Model implements TableType {
`${CacheScope.MODEL_ALIAS}:${this.base_id}:${this.source_id}:${this.title}`,
]);
CustomUrl.bulkDelete({ fk_model_id: this.id }, ncMeta).catch(() => {
logger.error(`Failed to delete custom urls of modelId: ${this.id}`);
});
cleanCommandPaletteCache(context.workspace_id).catch(() => {
logger.error('Failed to clean command palette cache');
});

10
packages/nocodb/src/models/View.ts

@ -1415,13 +1415,15 @@ export default class View implements ViewType {
}
}
if (view.fk_custom_url_id) {
await CustomUrl.delete({ id: view.fk_custom_url_id });
}
// on update, delete any optimised single query cache
await View.clearSingleQueryCache(context, view.fk_model_id, [view], ncMeta);
if (view.fk_custom_url_id) {
CustomUrl.delete({ id: view.fk_custom_url_id }).catch(() => {
logger.error(`Failed to delete custom urls of viewId: ${view.id}`);
});
}
cleanCommandPaletteCache(context.workspace_id).catch(() => {
logger.error('Failed to clean command palette cache');
});

Loading…
Cancel
Save