Skip to content

Commit

Permalink
fix: page config does not reevaluate on path change (same page)
Browse files Browse the repository at this point in the history
  • Loading branch information
schettn committed Oct 28, 2024
1 parent 86f917b commit a13c05f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/gatsby-plugin-jaen/src/slices/jaen-frame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from 'jaen'
import {graphql, SliceComponentProps} from 'gatsby'
import {useEffect, useState} from 'react'
import {globalHistory} from '@reach/router'

import {FaEdit} from '@react-icons/all-files/fa/FaEdit'
import {FaFileDownload} from '@react-icons/all-files/fa/FaFileDownload'
Expand Down Expand Up @@ -70,6 +71,16 @@ const Slice: React.FC<SliceProps> = props => {
setPageConfig(config)
})
}

globalHistory.listen(({action}) => {
if (action !== 'PUSH') return

if (props.pageConfig) {
parsePageConfig(props.pageConfig).then(config => {
setPageConfig(config)
})
}
})
}, [props.pageConfig])

useEffect(() => {
Expand Down

0 comments on commit a13c05f

Please sign in to comment.