- Deleted MemoContentContext and its associated types. - Updated Tag and TaskListItem components to use MemoViewContext instead. - Refactored MemoContent component to eliminate context provider and directly use derived values. - Simplified MemoViewContext to only include essential data. - Enhanced error handling in various components by introducing a centralized error handling utility. - Improved type safety across components and hooks by refining TypeScript definitions. - Updated remark plugins to enhance tag parsing and preserve node types.
20 lines
583 B
TypeScript
20 lines
583 B
TypeScript
import { NavigateOptions, useNavigate } from "react-router-dom";
|
|
|
|
const useNavigateTo = () => {
|
|
const navigateTo = useNavigate();
|
|
|
|
const navigateToWithViewTransition = (to: string, options?: NavigateOptions) => {
|
|
const doc = window.document as unknown as Document & { startViewTransition?: (callback: () => void) => void };
|
|
if (!doc.startViewTransition) {
|
|
navigateTo(to, options);
|
|
} else {
|
|
document.startViewTransition(() => {
|
|
navigateTo(to, options);
|
|
});
|
|
}
|
|
};
|
|
|
|
return navigateToWithViewTransition;
|
|
};
|
|
|
|
export default useNavigateTo;
|