fix: fixed hydr error in site navbar
This commit is contained in:
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user