Skip to content

Commit d63ded0

Browse files
authored
fix: Fix the UI doesn't refresh when navigating between packages (#148)
1 parent 26b808f commit d63ded0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/pages/Preview/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ export default function Preview() {
3636
const path = usePath();
3737

3838
useEffect(() => {
39-
if (!pkgname && path.pkgName !== pkgname) {
39+
if (path.pkgName && path.pkgName !== pkgname) {
4040
dispatch.global.setPkgname(path);
4141
dispatch.global.getDirectoryTrees({});
4242
dispatch.global.getPackageJSON({});
4343
}
44-
}, [pkgname, path.pkgName, dispatch.global, path]);
44+
}, [pkgname, dispatch.global, path]);
4545

4646
useEffect(() => {
4747
document.title = `${path.pkgName} - NPM UNPKG`;

0 commit comments

Comments
 (0)