import type { StoreSiteBlock } from "@alqove/api-client";

/**
 * Stable key for a block. The API assigns every block an id, so the index
 * fallback only matters for locally-constructed blocks in the editor before
 * their first save.
 */
export function blockKey(block: StoreSiteBlock, index: number): string {
  return block.id ?? `${block.type}-${index}`;
}
