File tree 1 file changed +7
-1
lines changed
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import Image from 'react-bootstrap/Image'
4
4
import Link from 'next/link'
5
5
import { useRouter } from 'next/router'
6
6
import Nav from 'react-bootstrap/Nav'
7
- import { useState } from 'react'
7
+ import { useState , useEffect } from 'react'
8
8
import { Form , Input , SubmitButton } from './form'
9
9
import { gql , useApolloClient , useMutation } from '@apollo/client'
10
10
import styles from './user-header.module.css'
@@ -199,8 +199,14 @@ export function NymActionDropdown ({ user, className = 'ms-2' }) {
199
199
}
200
200
201
201
function HeaderNym ( { user, isMe } ) {
202
+ const router = useRouter ( )
202
203
const [ editting , setEditting ] = useState ( false )
203
204
205
+ // if route changes, reset editting state
206
+ useEffect ( ( ) => {
207
+ setEditting ( false )
208
+ } , [ router . asPath ] )
209
+
204
210
return editting
205
211
? < NymEdit user = { user } setEditting = { setEditting } />
206
212
: < NymView user = { user } isMe = { isMe } setEditting = { setEditting } />
You can’t perform that action at this time.
0 commit comments