mirror of
https://github.com/directus/directus.git
synced 2026-01-29 23:47:57 -05:00
refresh edited insights panel on change (#10180)
* refresh edited insights panel on change * move api simpleHash to shared utils getSimpleHash * Simply reactivity fix for time-series * Remove unused import Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { simpleHash } from './get-simple-hash';
|
||||
|
||||
import { getSimpleHash } from '@directus/shared/utils';
|
||||
/**
|
||||
* Generate an index name for a given collection + fields combination.
|
||||
*
|
||||
@@ -20,7 +19,7 @@ export function getDefaultIndexName(
|
||||
|
||||
if (indexName.length <= 60) return indexName;
|
||||
|
||||
const suffix = `__${simpleHash(indexName)}_${type}`;
|
||||
const suffix = `__${getSimpleHash(indexName)}_${type}`;
|
||||
const prefix = indexName.substring(0, 60 - suffix.length);
|
||||
|
||||
return `${prefix}${suffix}`;
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
/**
|
||||
* Generate a simple short hash for a given string
|
||||
* This is not cryptographically secure in any way, and has a high chance of collision
|
||||
*/
|
||||
export function simpleHash(str: string) {
|
||||
let hash = 0;
|
||||
|
||||
for (let i = 0; i < str.length; hash &= hash) {
|
||||
hash = 31 * hash + str.charCodeAt(i++);
|
||||
}
|
||||
|
||||
return Math.abs(hash).toString(16);
|
||||
}
|
||||
Reference in New Issue
Block a user