Jump to content
Search Community

MorphSVG React

isaoBushi test
Moderator Tag

Recommended Posts

  • 6 months later...

This fix worked for MorphSVGPlugin, but now I'm getting a similar error for the gsap core:

 

Cannot read property 'querySelectorAll' of undefined

  624 | },
  625 |     //takes any value and returns an array. If it's a string (and leaveStrings isn't true), it'll use document.querySelectorAll() and convert that to an array. It'll also accept iterables like jQuery objects.
> 626 | toArray = function toArray(value, leaveStrings) {
      | ^
  627 |   return _isString(value) && !leaveStrings && (_coreInitted || !_wake()) ? _slice.call(_doc.querySelectorAll(value), 0) : _isArray(value) ? _flatten(value, leaveStrings) : _isArrayLike(value) ? _slice.call(value, 0) : value ? [value] : [];
  628 | },
  629 |     shuffle = function shuffle(a) {

EDIT: I think I got it, just made sure all gsap calls to element selectors are occurring within useEffect or inside (typeof window !== 'undefined') if blocks. Gatsby's SSR is still behaving super inconsistently, but that's their problem, not yours...

Edited by billyZduke
further details
Link to comment
Share on other sites

4 hours ago, billyZduke said:

EDIT: I think I got it, just made sure all gsap calls to element selectors are occurring within useEffect or inside (typeof window !== 'undefined') if blocks. Gatsby's SSR is still behaving super inconsistently, but that's their problem, not yours...

Just making sure you got it solved, @billyZduke

 

Also please remember to gsap.registerPlugin(MorphSVGPlugin)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...