Description
pubkeyToHexColor throws an Error when pubkey is an empty string. This function is called directly inside component template expressions (e.g., style="background-color: {pubkeyToHexColor(pubkey)}"). If the pubkey hasn't loaded yet, the component crashes.
File: src/lib/utils.nostr.ts
Affected Code
export function pubkeyToHexColor(pubkey: string): string {
if (!pubkey) {
throw new Error('Pubkey is required'); // throws inside templates
}
return `#${pubkey.slice(0, 6)}`;
}
Description
pubkeyToHexColorthrows anErrorwhenpubkeyis an empty string. This function is called directly inside component template expressions (e.g.,style="background-color: {pubkeyToHexColor(pubkey)}"). If the pubkey hasn't loaded yet, the component crashes.File:
src/lib/utils.nostr.tsAffected Code