Testing fix found on github for revalidate possibly
This commit is contained in:
@@ -19,10 +19,24 @@ export const getStaticPaths = async () => {
|
||||
};
|
||||
};
|
||||
|
||||
export const getStaticProps = wrapper.getStaticProps(
|
||||
(store) => async (context) => {
|
||||
const addRevalidateAndRedux = async (
|
||||
props: any,
|
||||
reduxStaticProps: any,
|
||||
revalidateSeconds = 50
|
||||
) => {
|
||||
const getStaticProps = await reduxStaticProps(props);
|
||||
getStaticProps.revalidate = revalidateSeconds;
|
||||
return getStaticProps;
|
||||
};
|
||||
|
||||
export const getStaticProps = async (props: any) =>
|
||||
addRevalidateAndRedux(
|
||||
props,
|
||||
wrapper.getStaticProps((store) => async (context) => {
|
||||
store.dispatch(getPost.initiate(context?.params?.slug));
|
||||
const [post] = await Promise.all(store.dispatch(getRunningQueriesThunk()));
|
||||
const [post] = await Promise.all(
|
||||
store.dispatch(getRunningQueriesThunk())
|
||||
);
|
||||
|
||||
return {
|
||||
props: {
|
||||
@@ -30,9 +44,13 @@ export const getStaticProps = wrapper.getStaticProps(
|
||||
},
|
||||
revalidate: 60,
|
||||
};
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
// export const getStaticProps = wrapper.getStaticProps(
|
||||
// (store) => async (context) => {}
|
||||
// );
|
||||
|
||||
const Post = ({ post }: any) => {
|
||||
const dateUploaded = new Date(post.date).toDateString();
|
||||
const modified = new Date(post.modified).toDateString();
|
||||
|
||||
Reference in New Issue
Block a user