fix(e2e): stabilize initial board hydration
This commit is contained in:
2 files changed
+7
-10
No files matched your search
@@ -88,8 +88,11 @@ describe("lazy widget application graph", () => {
|
|||||||
);
|
);
|
||||||
await expect(clockWidget).toBeVisible({ timeout: 15_000 });
|
await expect(clockWidget).toBeVisible({ timeout: 15_000 });
|
||||||
|
|
||||||
|
await expect(page.locator("[data-homarr-dev-benchmark-spotlight-preloaded]")).toHaveCount(1, {
|
||||||
|
timeout: 15_000,
|
||||||
|
});
|
||||||
await page.keyboard.press("Control+K");
|
await page.keyboard.press("Control+K");
|
||||||
await expect(page.locator("[data-homarr-dev-benchmark-spotlight]")).toBeVisible();
|
await expect(page.locator("[data-homarr-dev-benchmark-spotlight]")).toBeVisible({ timeout: 15_000 });
|
||||||
await page.keyboard.press("Escape");
|
await page.keyboard.press("Escape");
|
||||||
await expect(page.locator("[data-homarr-dev-benchmark-spotlight]")).not.toBeVisible();
|
await expect(page.locator("[data-homarr-dev-benchmark-spotlight]")).not.toBeVisible();
|
||||||
|
|
||||||
|
|||||||
@@ -43,19 +43,13 @@ export default function ClockWidget({ options, width }: WidgetComponentProps<"cl
|
|||||||
{options.customTitle}
|
{options.customTitle}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
<Title
|
<Title className="clock-time-text" fw={700} order={sizing === "md" ? 2 : sizing === "sm" ? 4 : 6} lh="1">
|
||||||
className="clock-time-text"
|
|
||||||
fw={700}
|
|
||||||
order={sizing === "md" ? 2 : sizing === "sm" ? 4 : 6}
|
|
||||||
lh="1"
|
|
||||||
suppressHydrationWarning
|
|
||||||
>
|
|
||||||
{options.customTimeFormat
|
{options.customTimeFormat
|
||||||
? dayjs(time).tz(timezone).format(customTimeFormat)
|
? dayjs(time).tz(timezone).format(customTimeFormat)
|
||||||
: dayjs(time).tz(timezone).format(timeFormat)}
|
: dayjs(time).tz(timezone).format(timeFormat)}
|
||||||
</Title>
|
</Title>
|
||||||
{options.showDate && (
|
{options.showDate && (
|
||||||
<Text className="clock-date-text" size={sizing} lineClamp={1} suppressHydrationWarning>
|
<Text className="clock-date-text" size={sizing} lineClamp={1}>
|
||||||
{options.customDateFormat
|
{options.customDateFormat
|
||||||
? dayjs(time).tz(timezone).format(customDateFormat)
|
? dayjs(time).tz(timezone).format(customDateFormat)
|
||||||
: dayjs(time).tz(timezone).format(dateFormat)}
|
: dayjs(time).tz(timezone).format(dateFormat)}
|
||||||
@@ -96,7 +90,7 @@ interface UseCurrentTimeProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const useCurrentTime = ({ showSeconds }: UseCurrentTimeProps) => {
|
const useCurrentTime = ({ showSeconds }: UseCurrentTimeProps) => {
|
||||||
const [time, setTime] = useState(new Date());
|
const [time, setTime] = useState(() => new Date(0));
|
||||||
const timeoutRef = useRef<NodeJS.Timeout>(null);
|
const timeoutRef = useRef<NodeJS.Timeout>(null);
|
||||||
const intervalRef = useRef<NodeJS.Timeout>(null);
|
const intervalRef = useRef<NodeJS.Timeout>(null);
|
||||||
const intervalMultiplier = useMemo(() => (showSeconds ? 1 : 60), [showSeconds]);
|
const intervalMultiplier = useMemo(() => (showSeconds ? 1 : 60), [showSeconds]);
|
||||||
|
|||||||
Reference in new issue
Block a user