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,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();