fix: sparkline canvas wrapper display mode for flex layout

Change sparkline wrapper from inline-block to block w-full to properly
fill flex parent container. Inline-block was preventing the canvas from
calculating the correct width when width={0} (auto-size mode).
This commit is contained in:
rcourtman 2025-11-09 22:35:32 +00:00
parent 886368ec44
commit 4c6f565855
2 changed files with 12 additions and 3 deletions

View file

@ -255,10 +255,10 @@ export const Sparkline: Component<SparklineProps> = (props) => {
};
return (
<div class="relative inline-block">
<div class="relative block w-full">
<canvas
ref={canvasRef}
class="inline-block cursor-crosshair"
class="block cursor-crosshair"
style={{
width: `${width()}px`,
height: `${height()}px`,

View file

@ -112,10 +112,19 @@ function saveToLocalStorage(): void {
function loadFromLocalStorage(): void {
try {
const stored = localStorage.getItem(STORAGE_KEY);
if (!stored) return;
if (!stored) {
logger.debug('[MetricsHistory] No stored data found');
return;
}
const payload = JSON.parse(stored);
if (!payload || typeof payload !== 'object') {
logger.warn('[MetricsHistory] Invalid payload format, clearing');
localStorage.removeItem(STORAGE_KEY);
return;
}
// Check version and age
if (payload.version !== STORAGE_VERSION) {
logger.warn('[MetricsHistory] Storage version mismatch, clearing');