Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: Cannot assign to read only property 'initialLayout' of false #17

Closed
blisst opened this issue Jul 15, 2015 · 9 comments

Comments

@blisst
Copy link

blisst commented Jul 15, 2015

Can't use the addon, ember-cli@0.2.7

When I click a thumbnail I get Uncaught TypeError: Cannot assign to read only property 'initialLayout' of false.

Offending code:

_registerModule('Controller', {
    ....
    _listen('initialLayout', function() {
                self.currItem.initialLayout = _options.getThumbBoundsFn && _options.getThumbBoundsFn(_currentItemIndex);
            });

My template:

{{#photo-swipe}}
      {{#each model.bar.photos as |image|}}
        <a class="photo-item" href="{{image.url}}" data-width="{{image.width}}" data-height="{{image.height}}">
          <img src="{{image.url}}" alt="" />
        </a>
      {{/each}}
{{/photo-swipe}}
@DanielOchoa
Copy link
Contributor

Interesting. The offending code is not part of the addon. If you remove the photoswipe component and just iterate over the photos on the template, are you able to make the the photos render?

@blisst
Copy link
Author

blisst commented Jul 15, 2015

Yes I was previously rendering the photos with no problems, using fancyBox till I found out fancyBox doesn't have swipe support.

@blisst
Copy link
Author

blisst commented Jul 16, 2015

Wait so you closed it because it is an issue not with the add-on? It's definitely something to do with Photoswipe.

@DanielOchoa
Copy link
Contributor

I wasn't able to reproduce it on a new ember-cli app with that version

On Wed, Jul 15, 2015 at 11:33 PM blisst notifications@github.com wrote:

Wait so you closed it because it is an issue not with the add-on? It's
definitely something to do with Photoswipe.


Reply to this email directly or view it on GitHub
#17 (comment)
.

@iamjstates
Copy link

@blisst - did you ever fix this problem. I'm having the same issue

@edborden
Copy link

edborden commented Feb 1, 2016

Also seeing this (ember@2.3,ember-cli@2.3).... Only reference I can find is dimsemenov/PhotoSwipe#1041, with no fix

@blisst
Copy link
Author

blisst commented Feb 1, 2016

I apologize I haven't been working in Ember for a while now and thus don't remember what ended up happening...

@edborden
Copy link

edborden commented Feb 2, 2016

I figured it out. Basically, I was passing an arrays of image models to the component, where the component requires an array of vanilla js objects. Since that array gets passed straight through, PhotoSwipe was choking on it.

@rogyvoje
Copy link

rogyvoje commented Jun 3, 2019

I got the same error when I passed an empty array. Make sure you are sending images to the photo swipe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants