Skip to content

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
MrWangJustToDo committed Jan 20, 2025
1 parent 9c1d9e6 commit c26ecc7
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 89 deletions.
6 changes: 4 additions & 2 deletions packages/react/src/components/DiffView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { diffFontSizeName } from "@git-diff-view/utils";
import { memo, useEffect, useMemo, forwardRef, useImperativeHandle, useRef } from "react";
import * as React from "react";

import { useIsMounted } from "../hooks/useIsMounted";
import { useUnmount } from "../hooks/useUnmount";

import { DiffSplitView } from "./DiffSplitView";
Expand Down Expand Up @@ -114,6 +115,8 @@ const _InternalDiffView = <T extends unknown>(props: Omit<DiffViewProps<T>, "dat

const diffFileId = useMemo(() => diffFile.getId(), [diffFile]);

const isMounted = useIsMounted();

const wrapperRef = useRef<HTMLDivElement>();

// performance optimization
Expand Down Expand Up @@ -199,8 +202,7 @@ const _InternalDiffView = <T extends unknown>(props: Omit<DiffViewProps<T>, "dat
}}
>
<div
suppressHydrationWarning
id={`diff-root${diffFileId}`}
id={isMounted ? `diff-root${diffFileId}` : undefined}
className={"diff-view-wrapper" + (className ? ` ${className}` : "")}
style={style}
>
Expand Down
11 changes: 11 additions & 0 deletions packages/react/src/hooks/useIsMounted.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { useEffect, useState } from "react";

export const useIsMounted = () => {
const [isMounted, setIsMounted] = useState(false);

useEffect(() => {
setIsMounted(true);
}, []);

return isMounted;
};
1 change: 1 addition & 0 deletions packages/shiki/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"license": "MIT",
"version": "0.0.25",
"types": "index.d.ts",
"main": "./dist/esm/index.mjs",
"type": "module",
"files": [
"dist",
Expand Down
15 changes: 1 addition & 14 deletions packages/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"author": "MrWangJustToDo",
"license": "MIT",
"version": "0.0.25",
"main": "index.js",
"main": "./dist/vue-git-diff-view.mjs",
"type": "module",
"types": "index.d.ts",
"files": [
Expand Down Expand Up @@ -35,19 +35,6 @@
"./styles/*": "./dist/css/*",
"./package.json": "./package.json"
},
"buildOptions": [
{
"input": "./src/index.withStyle.ts",
"output": [
{
"dir": "./dist",
"entryFileNames": "esm/index.mjs",
"format": "esm",
"sourcemap": true
}
]
}
],
"keywords": [
"diff component",
"vue diff component"
Expand Down
138 changes: 69 additions & 69 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions ui/next-app-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@git-diff-view/react": "workspace:*",
"react": "19.0.0",
"react-dom": "19.0.0",
"next": "15.1.2"
"next": "^15.1.5"
},
"devDependencies": {
"typescript": "^5",
Expand All @@ -23,6 +23,6 @@
"postcss": "^8",
"tailwindcss": "^3.4.1",
"eslint": "^8",
"eslint-config-next": "15.0.3"
"eslint-config-next": "^15.1.5"
}
}
4 changes: 2 additions & 2 deletions ui/next-page-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@git-diff-view/react": "workspace:*",
"react": "19.0.0",
"react-dom": "19.0.0",
"next": "15.1.2"
"next": "^15.1.5"
},
"devDependencies": {
"typescript": "^5",
Expand All @@ -22,6 +22,6 @@
"postcss": "^8",
"tailwindcss": "^3.4.1",
"eslint": "^8",
"eslint-config-next": "15.0.3"
"eslint-config-next": "^15.1.5"
}
}

0 comments on commit c26ecc7

Please sign in to comment.