Browse Source

fix(nocodb): use includes to check if NONE is in target list

pull/5770/head
Wing-Kam Wong 1 year ago
parent
commit
957f04e1fd
  1. 4
      packages/nocodb/src/cache/RedisCacheMgr.ts

4
packages/nocodb/src/cache/RedisCacheMgr.ts vendored

@ -135,7 +135,7 @@ export default class RedisCacheMgr extends CacheMgr {
// e.g. arr = ["nc:<orgs>:<scope>:<model_id_1>", "nc:<orgs>:<scope>:<model_id_2>"]
const arr = (await this.get(key, CacheGetType.TYPE_ARRAY)) || [];
log(`RedisCacheMgr::getList: getting list with key ${key}`);
const isNoneList = arr.length && arr[0] === 'NONE';
const isNoneList = arr.length && arr.includes('NONE');
if (isNoneList) {
return Promise.resolve({
@ -248,7 +248,7 @@ export default class RedisCacheMgr extends CacheMgr {
: `${this.prefix}:${scope}:${subListKeys.join(':')}:list`;
log(`RedisCacheMgr::appendToList: append key ${key} to ${listKey}`);
let list = (await this.get(listKey, CacheGetType.TYPE_ARRAY)) || [];
if (list.length && list[0] === 'NONE') {
if (list.length && list.includes('NONE')) {
list = [];
await this.del(listKey);
}

Loading…
Cancel
Save