Skip to content

Commit

Permalink
Merge pull request #13 from getcronit/main
Browse files Browse the repository at this point in the history
fix: page config does not reevaluate on path change (same page)
  • Loading branch information
schettn authored Oct 28, 2024
2 parents 86f917b + a13c05f commit 40e04ea
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 40e04ea

Please sign in to comment.