fix: fixed hydr error in site navbar

This commit is contained in:
poyrazavsever
2026-03-10 15:11:31 +03:00
parent 4c0be0374c
commit d732f9b1c3
3 changed files with 29 additions and 16 deletions
+21
View File
@@ -0,0 +1,21 @@
"use client";
import { useSyncExternalStore } from "react";
const APPLE_DEVICE_PATTERN = /(Mac|iPhone|iPad)/i;
function subscribe() {
return () => {};
}
function getServerSnapshot() {
return "Ctrl K";
}
function getClientSnapshot() {
return APPLE_DEVICE_PATTERN.test(window.navigator.platform) ? "Cmd K" : "Ctrl K";
}
export function useKeyboardShortcutLabel() {
return useSyncExternalStore(subscribe, getClientSnapshot, getServerSnapshot);
}