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

Issue in latest version of assemble #9

Open
stefanwalther opened this issue Jul 19, 2016 · 11 comments
Open

Issue in latest version of assemble #9

stefanwalther opened this issue Jul 19, 2016 · 11 comments
Labels

Comments

@stefanwalther
Copy link
Contributor

stefanwalther commented Jul 19, 2016

Hi @jonschlinkert,

can you think of the reason why this is failing:

https://travis-ci.org/assemble/assemble-workshop/jobs/145969664

What did change in recent versions?
Does collection-basic not follow best practices?

Regards
Stefan

@jonschlinkert
Copy link
Member

@stefanwalther looks like it's passing now. not sure why it was failing before

@stefanwalther
Copy link
Contributor Author

OK, I'll check and re-activate again, thx.

@stefanwalther
Copy link
Contributor Author

stefanwalther commented Jul 26, 2016

@jonschlinkert: No, actually still the same problem:
https://travis-ci.org/assemble/assemble-workshop/jobs/147597233

Note: running it locally also fully works, seems to be an issue with travis, same issue on appveyor: https://ci.appveyor.com/project/stefanwalther/assemble-workshop/build/1.0.13/job/ombo46ncv27phjqr

@doowb
Copy link
Member

doowb commented Jul 26, 2016

These 2 lines are probably causing a circular reference when the context is merged before doing the actual rendering.

@stefanwalther
Copy link
Contributor Author

So a deep-copy or clone would the probably do the trick, right?
I'll give it a try.

@stefanwalther
Copy link
Contributor Author

No, unfortunately that wasn't the case - I think:

Changed from:

view.data.articles = app.views.articles;
view.data.pages = app.views.pages;

to:

view.data.articles = _.clone( app.views.articles );
view.data.pages = _.clone( app.views.pages );

Results:

@jonschlinkert
Copy link
Member

jonschlinkert commented Jul 26, 2016

you can probably figure out the problem quickly by emitting listening for the errors. The error message, no writecb in Transform class, indicates that you probably don't have an error listener in the pipeline.

For debugging, try doing this:

app.src('foo').on('error', console.log)
  .pipe(bar()).on('error', console.log)

and add that .on('error', ...) listener to all of the things being piped

@doowb
Copy link
Member

doowb commented Jul 26, 2016

It looks like the goal is to expose those view collections on the context used in Handlebars when rendering. I think it's a better approach to just set them on app.cache.data by doing this inside the init task after the collections have been loaded:

app.data({
  articles: app.views.articles,
  pages: app.views.pages
});

Then remove the preRender middleware. Now the references to those collections will still be kept so changes made to the views and data on the views will still be updated (if needed).

Also, it's a good idea to listen for those errors to track down where the error is occurring. As Jon said, it should help track down the issue faster.

@stefanwalther
Copy link
Contributor Author

OK, thx again, will give it a new try ;-)

@stefanwalther
Copy link
Contributor Author

stefanwalther commented Aug 3, 2016

Hi @doowb,

also not works, by following your advice I get:
AssertionError: expected [RangeError: Maximum call stack size exceeded] to not exist

Again, the strange thing is that "my" approach still works on OSX, but not on travis (a pure Linux whatever distribution).

Still not idea how to make this test successful.

(And I actually use this approach in several of my solutions - so it is quite important for me ;-))

@jonschlinkert
Copy link
Member

and add that .on('error', ...) listener to all of the things being piped

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

No branches or pull requests

3 participants