From 1a5708f6bbc637b8574d4f7088dd32f25c99a94f Mon Sep 17 00:00:00 2001 From: Joseph Shearer Date: Wed, 21 Feb 2024 11:47:55 -0500 Subject: [PATCH] Fix ref error, reduce unused queries, reduce CLS drastically on homepage --- gatsby-ssr.tsx | 2 +- src/components/ContextTooltip.tsx | 3 ++- src/style.less | 8 +------ src/templates/blog-post.tsx | 40 +------------------------------ 4 files changed, 5 insertions(+), 48 deletions(-) diff --git a/gatsby-ssr.tsx b/gatsby-ssr.tsx index 8ae7d5f3..8e5a706f 100644 --- a/gatsby-ssr.tsx +++ b/gatsby-ssr.tsx @@ -29,6 +29,6 @@ exports.onRenderBody = ({ setHtmlAttributes, setHeadComponents }) => { gtag('config', '${GA_MEASUREMENT_ID}', { send_page_view: false })` }} />, - , + // , ]) } diff --git a/src/components/ContextTooltip.tsx b/src/components/ContextTooltip.tsx index 277ceaa9..c6ae6ded 100644 --- a/src/components/ContextTooltip.tsx +++ b/src/components/ContextTooltip.tsx @@ -22,7 +22,7 @@ const HtmlTooltip = styled(({ className, ...props }: TooltipProps) => ( }, })) -export const ContextToolTip = React.forwardRef((props: TooltipProps) => { +export const ContextToolTip = React.forwardRef((props: TooltipProps, ref) => { const [open, setOpen] = useState(false) const handleTooltipClose = () => { @@ -39,6 +39,7 @@ export const ContextToolTip = React.forwardRef((props: TooltipProps) => { onClick={handleTooltipOpen} onClose={handleTooltipClose} arrow + ref={ref} {...props} /> ) diff --git a/src/style.less b/src/style.less index d5d9cc9f..9ce73e09 100644 --- a/src/style.less +++ b/src/style.less @@ -3330,12 +3330,7 @@ table th { } .section-one-right { - position: relative; - top: -2.5em; - margin-bottom: -3em; - margin-left: auto; - justify-content: flex-end; - max-width: unset; + display: none; } .section-one-right-image { @@ -6802,7 +6797,6 @@ table th { padding-bottom: 20px; display: flex; @media (max-width: 810px){ - margin-top: 100px; padding-right: 16px; height: 120px; padding-bottom: 20px; diff --git a/src/templates/blog-post.tsx b/src/templates/blog-post.tsx index 6ae91895..5ff860eb 100644 --- a/src/templates/blog-post.tsx +++ b/src/templates/blog-post.tsx @@ -19,7 +19,7 @@ import { RenderToc } from "../components/BlogPostToc" dayjs.extend(reltime) -const BlogPostTemplate = ({ data: { previous, next, post }, pageContext }) => { +const BlogPostTemplate = ({ data: { post }, pageContext }) => { const postTags = post.tags.filter(tag => tag.type === "tag") const [windowWidth, setWindowWidth] = useState( typeof window === "undefined" ? 1500 : window.innerWidth @@ -196,8 +196,6 @@ export default BlogPostTemplate export const pageQuery = graphql` query BlogPostBySlug( $id: String! - $previousPostId: String - $nextPostId: String ) { site { siteMetadata { @@ -258,41 +256,5 @@ export const pageQuery = graphql` type: Type } } - previous: strapiBlogPost(id: { eq: $previousPostId }) { - title: Title - slug: Slug - authors { - name: Name - picture: Picture { - localFile { - childImageSharp { - gatsbyImageData( - layout: CONSTRAINED - placeholder: BLURRED - ) - } - } - } - link: Link - } - } - next: strapiBlogPost(id: { eq: $nextPostId }) { - title: Title - slug: Slug - authors { - name: Name - picture: Picture { - localFile { - childImageSharp { - gatsbyImageData( - layout: CONSTRAINED - placeholder: BLURRED - ) - } - } - } - link: Link - } - } } `