branch-chat / src /utils /ids.js
suvadityamuk's picture
suvadityamuk HF Staff
fix: remove ghost text labels in graph view
7334a07
Raw
History Blame Contribute Delete
326 Bytes
/**
* Generate a unique ID using the browser's crypto API.
* Falls back to a timestamp-based ID if crypto is unavailable.
*/
export function generateId() {
if (typeof crypto !== 'undefined' && crypto.randomUUID) {
return crypto.randomUUID();
}
return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
}