question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Post inline images not showing when using gatsby-source-wordpress with Framer Motion animation

See original GitHub issue

Preliminary Checks

Description

Hi there,

I have a new Gatsby site which sources page content from a Wordpress site via gatsby-source-wordpress.

It also uses Framer Motion to provide page transitions via the AnimatePresence component.

After updating Gatsby recently I have noticed that there is a bug arising with images in the page content. On the initial page load, or when pressing refresh, the images show as expected, however when a page is navigated to via another page (i.e. invoking the AnimatePresence animation, the images are not revealed.

Note 1: this only happens when the exitBeforeEntry prop is set on the AnimatePresence component (which is required

Note 2: this only occurs with images in the post content. If I display other images (e.g. the post’s featured image) using GatsbyImage, they load as expected in all situations.

Any help would be much appreciated. I’m at a loss with how to debug this issue. Thanks.

Reproduction Link

https://github.com/mrbjjackson/gatsby-source-wordpress-framer-motion-bug

Steps to Reproduce

I have created a minimal reproduction that demonstrates the problem.

Also - there is a live version of the site here

Essentially, this bug occurs when using Gatsby 4, gatsby-source-wordpress with Framer Motion. I have recently updated the site (from Gatsyb 2) and I’m 90% sure this bug was not occuring before I updated.

Expected Result

The post content images to display as usual.

Actual Result

Post images show on the initial page load. However if you navigate to the page from another page, they do not appear.

Environment

System:
    OS: macOS Mojave 10.14.6
    CPU: (8) x64 Intel(R) Core(TM) i7-4750HQ CPU @ 2.00GHz
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 15.11.0 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.6.0 - /usr/local/bin/npm
  Languages:
    Python: 2.7.10 - /usr/bin/python
  Browsers:
    Chrome: 96.0.4664.55
    Firefox: 94.0.1
    Safari: 12.1.2
  npmPackages:
    gatsby: ^4.4.0-next.0 => 4.4.0-next.0 
    gatsby-plugin-image: ^2.3.0 => 2.3.0 
    gatsby-plugin-manifest: ^4.3.0 => 4.3.0 
    gatsby-plugin-react-helmet: ^5.3.0 => 5.3.0 
    gatsby-plugin-sharp: ^4.3.0 => 4.3.0 
    gatsby-plugin-sitemap: ^5.3.0 => 5.3.0 
    gatsby-source-wordpress: ^6.3.0 => 6.3.0 
    gatsby-transformer-sharp: ^4.3.0 => 4.3.0 
  npmGlobalPackages:
    gatsby-cli: 4.2.0

Config Flags

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:20 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
mrbjjacksoncommented, Jan 19, 2022

The only work around I found for the time-being was to add the following option to gatsby-config.js as an option in gatsby-source-wordpress:

html: {
          useGatsbyImage: false
}

See here for documentation

Obviously this is far from ideal as the Gatsby Image optimisations are one of my primary reasons for using Gatsby. However for now it does work as a fix for me.

0reactions
github-actions[bot]commented, May 21, 2022

Hey again!

It’s been 60 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to comment on this issue or create a new one if you need anything else. As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks again for being part of the Gatsby community! 💪💜

Read more comments on GitHub >

github_iconTop Results From Across the Web

draftbox-co/gatsby-wordpress-inline-images
Gatsby WordPress inline images doesn't process images in blocks of text which means your admin site has to serve the images. This plugin…...
Read more >
Common problems faced with Gatsby Image - The Wirescript
Recently I ran into some issues while using Gatsby Image, so a post with some workarounds.
Read more >
Inline Images in Gatsby Wordpress source plugin
Try to clear cache. I'm using gatsby-source-wordpressV3 and this plugin does not work with it.
Read more >
Accessibility | Framer for Developers
How to design accessible animations with Framer Motion. ... In this guide, we'll learn how to use the reducedMotion option and useReducedMotion hook...
Read more >
Building Gatsby Themes For WordPress-Powered Websites
Both are available via the official WordPress plugins repository and do not require any configuration. What Are Gatsby Themes? #. Gatsby theme ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found