Testing fix found on github for revalidate possibly

This commit is contained in:
Frank
2023-10-04 19:50:45 -06:00
parent 01db3125e0
commit ab7a720899

View File

@@ -19,19 +19,37 @@ export const getStaticPaths = async () => {
}; };
}; };
export const getStaticProps = wrapper.getStaticProps( const addRevalidateAndRedux = async (
(store) => async (context) => { props: any,
store.dispatch(getPost.initiate(context?.params?.slug)); reduxStaticProps: any,
const [post] = await Promise.all(store.dispatch(getRunningQueriesThunk())); revalidateSeconds = 50
) => {
const getStaticProps = await reduxStaticProps(props);
getStaticProps.revalidate = revalidateSeconds;
return getStaticProps;
};
return { export const getStaticProps = async (props: any) =>
props: { addRevalidateAndRedux(
post: post.data[0], props,
}, wrapper.getStaticProps((store) => async (context) => {
revalidate: 60, store.dispatch(getPost.initiate(context?.params?.slug));
}; const [post] = await Promise.all(
} store.dispatch(getRunningQueriesThunk())
); );
return {
props: {
post: post.data[0],
},
revalidate: 60,
};
})
);
// export const getStaticProps = wrapper.getStaticProps(
// (store) => async (context) => {}
// );
const Post = ({ post }: any) => { const Post = ({ post }: any) => {
const dateUploaded = new Date(post.date).toDateString(); const dateUploaded = new Date(post.date).toDateString();