isotope-packery icon indicating copy to clipboard operation
isotope-packery copied to clipboard

Error: No Layout mode: packery

Open homerjam opened this issue 6 years ago • 6 comments

Hi!

I get the below message using 2.0.1 but not 2.0.0:

No Layout mode: packery

I'm bundling Isotope in a Nuxt.js app which uses Webpack with the following syntax:

const Isotope = require('isotope-layout');
require('isotope-packery');

const iso = new Isotope(el, options);

I've dug around the commit history and haven't been able to figure out what changed in the patch version update - do you have any idea?

Many thanks, James

homerjam avatar May 16 '18 15:05 homerjam

Thanks for reporting this issue. Could you try just requiring isotope-packery ?

const Isotope = require('isotope-packery');

const iso = new Isotope(el, options);

desandro avatar May 16 '18 15:05 desandro

Thanks for the suggestion, I've just tried it but no luck. I'm now getting:

client.js:522 TypeError: Cannot read property 'packery' of undefined
    at Mode.LayoutMode (layout-mode.js:38)

Inspecting the source it seems the LayoutMode function is being passed an element rather than the isotope instance:

  // layout mode class
  function LayoutMode( isotope ) {
    this.isotope = isotope; // <-- added breakpoint here and confirmed `isotope` is an element (the container)
    // link properties
    if ( isotope ) {
      this.options = isotope.options[ this.namespace ];
      this.element = isotope.element;
      this.items = isotope.filteredItems;
      this.size = isotope.size;
    }
  }

Does that help at all?

homerjam avatar May 16 '18 15:05 homerjam

I'll have to take a look at the issue here.

desandro avatar May 18 '18 00:05 desandro

Same issue here v2.0.0 and 2.0.1 with isotope v3.0.0 and 3.0.6

Tofandel avatar Aug 15 '18 19:08 Tofandel

I think it may be due to the load order of the packery, i have this issue suddenly when I changed my js load order.

yellow1912 avatar Nov 12 '18 09:11 yellow1912

I was able to get this working by doing:

import Isotope from 'isotope-layout'
import 'isotope-packery'

const isotope = new Isotope(...)

gregdev avatar Feb 24 '23 03:02 gregdev