File tree 3 files changed +4
-33
lines changed
src/components/modules/peek
3 files changed +4
-33
lines changed Original file line number Diff line number Diff line change @@ -36,5 +36,6 @@ next-env.d.ts
36
36
.env
37
37
.idea
38
38
39
-
40
39
.vscode /sftp.json
40
+
41
+ src /app /dev
Original file line number Diff line number Diff line change 1
1
import { useQuery } from '@tanstack/react-query'
2
- import { useEffect , useMemo } from 'react'
2
+ import { useMemo } from 'react'
3
3
import { atom } from 'jotai'
4
4
import type { NoteWrappedPayload } from '@mx-space/api-client'
5
5
import type { FC } from 'react'
@@ -36,21 +36,6 @@ export const NotePreview: FC<NotePreviewProps> = (props) => {
36
36
...queries . note . byNid ( props . noteId . toString ( ) ) ,
37
37
} )
38
38
39
- useEffect ( ( ) => {
40
- const currentState = history . state
41
- const currentLocation = window . location . href
42
- const nextUrl = new URL ( currentLocation )
43
- nextUrl . pathname = `/notes/${ props . noteId } `
44
- const nextUrlString = nextUrl . href
45
-
46
- // 虽然但是,这样浏览器的前进后退会有问题
47
- // 如果用 NextJS 的 parallel-routes 情况太复杂
48
- history . replaceState ( null , '' , nextUrlString )
49
- return ( ) => {
50
- history . replaceState ( currentState , '' , currentLocation )
51
- }
52
- } , [ props . noteId ] )
53
-
54
39
const overrideAtom = useMemo ( ( ) => atom ( null ! as NoteWrappedPayload ) , [ ] )
55
40
if ( isLoading ) return < Loading className = "w-full" useDefaultLoadingText />
56
41
if ( ! data ) return null
Original file line number Diff line number Diff line change 1
1
import { useQuery } from '@tanstack/react-query'
2
- import { useEffect , useMemo } from 'react'
2
+ import { useMemo } from 'react'
3
3
import Balancer from 'react-wrap-balancer'
4
4
import { atom } from 'jotai'
5
5
import type { PostModel } from '@mx-space/api-client'
@@ -34,21 +34,6 @@ export const PostPreview: FC<PostPreviewProps> = (props) => {
34
34
...queries . post . bySlug ( category , slug ) ,
35
35
} )
36
36
37
- useEffect ( ( ) => {
38
- const currentState = history . state
39
- const currentLocation = window . location . href
40
- const nextUrl = new URL ( currentLocation )
41
- nextUrl . pathname = `/posts/${ category } /${ slug } `
42
- const nextUrlString = nextUrl . href
43
-
44
- // 虽然但是,这样浏览器的前进后退会有问题
45
- // 如果用 NextJS 的 parallel-routes 情况太复杂
46
- history . replaceState ( null , '' , nextUrlString )
47
- return ( ) => {
48
- history . replaceState ( currentState , '' , currentLocation )
49
- }
50
- } , [ category , slug ] )
51
-
52
37
const overrideAtom = useMemo ( ( ) => atom ( null ! as PostModel ) , [ ] )
53
38
if ( isLoading ) return < Loading className = "w-full" useDefaultLoadingText />
54
39
if ( ! data ) return null
You can’t perform that action at this time.
0 commit comments