Coder Social home page Coder Social logo

Comments (17)

assemblebot avatar assemblebot commented on May 29, 2024

@criticalmash Thanks for the issue! If you're reporting a bug, please be sure to include:

  • The version of assemble you are using.
  • Your assemblefile.js (This can be in a gist)
  • The commandline output. (Screenshot or gist is fine)
  • What you expected to happen instead.

If your issue is related to one of the following, please open an issue there:

  • grunt-assemble Issues with using assemble in grunt or the grunt-assemble library.
  • handlebars-helpers Issues with using handlebars helpers from the handlebars-helpers library.

from assemble.

criticalmash avatar criticalmash commented on May 29, 2024

Hello, still haven't been able to figure this out on my own. I have an upcoming project that I'd like build using Assemble. It has a lot of custom content types and I'm afraid that this issue will be a huge block towards using Assemble.

If you need more details, or if this issue belongs under a different repo, please let me know.

Thanks

from assemble.

doowb avatar doowb commented on May 29, 2024

The code above looks correct. I'll try to take a closer look at the repository within the next few days.

If you have a stacktrace of the error, that could help. If one didn't come out originally, you can use --verbose and it should show more information.

from assemble.

criticalmash avatar criticalmash commented on May 29, 2024

Thanks for the tip on verbose mode. Here's what I get when I run it...

TypeError: this.emit is not a function
    at Object.Cache.get (/Users/john/Sites/assemble/asm-pager-test/node_modules/cache-base/index.js:150:10)
    at /Users/john/Sites/assemble/asm-pager-test/node_modules/async-helpers/index.js:333:36
    at /Users/john/Sites/assemble/asm-pager-test/node_modules/co/index.js:136:8
    at new Promise (<anonymous>)
    at thunkToPromise (/Users/john/Sites/assemble/asm-pager-test/node_modules/co/index.js:135:10)
    at toPromise (/Users/john/Sites/assemble/asm-pager-test/node_modules/co/index.js:119:55)
    at next (/Users/john/Sites/assemble/asm-pager-test/node_modules/co/index.js:99:29)
    at onFulfilled (/Users/john/Sites/assemble/asm-pager-test/node_modules/co/index.js:69:7)
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:228:7)

I did some quick console.loging inside Cache.get function and it appears that this is being called on a year helper that doesn't have an emit function. Works fine when looping over pages. I'll dig around more and see if I can find anything else.

from assemble.

doowb avatar doowb commented on May 29, 2024

@criticalmash I noticed a comment in your repository that something is transforming a published property into a Date object. Are you able to remove or renamed all of the published properties to see if that makes a difference? There could be something else causing the error than just templates and helpers.

from assemble.

criticalmash avatar criticalmash commented on May 29, 2024

Sure I can remove that. I put it in because I wasn't able to use the helper.

from assemble.

criticalmash avatar criticalmash commented on May 29, 2024

Just pushed an updated assemble file with the middleware commented.

from assemble.

criticalmash avatar criticalmash commented on May 29, 2024

This issue seems to be related somehow to the pagination task. I started commenting out various parts of my newspager task and learned that if I comment out the pageObj.data line (line 142 in assemblefile.js) the newsitems print with the year helper. So I'm thinking that something is happening to the newsitems when they are added to another view.

I'm wondering if making a deep copy of the views at some point of the process would fix the issue. Any ideas?

from assemble.

doowb avatar doowb commented on May 29, 2024

Good catch... There might be some recursion going on because of the getters and settings being used. The error doesn't lead to that conclusion but it could be that the streams and the async parts of node making it so an object is being mutated in some way and the error happens at a different point and that's just where the stack trace points.

I was trying to track it down to other places too and now I'm trying it to something with the items list itself from the pagination.

from assemble.

criticalmash avatar criticalmash commented on May 29, 2024

Been trying the clone route.

Cloning the page object before using it to create a newslist view allowed me to iterate over the views inside of default.hbs. So it seemed like I had it fixed.

When I tried to use a helper inside an #each loop within a paginated list of results, I got the same 'this.emit is not a function' error as before. So it looks like something is happening when a renderable view is used as an object inside another renderable view.

from assemble.

doowb avatar doowb commented on May 29, 2024

@criticalmash I found the bug... it's pretty obscure and I'll get a fix up soon.

TL;DR; it's a mix of things that we've fixed in other places, but overlooked it in some places.

Basically, assemble adds properties to the context used by helpers so helpers can access things as a convenience. Then in the async helper's library, to ensure the same context is used when resolving the helper values, the context is saved internally and used with .apply when calling the helper function.

The context is added to an internal object using define-property to make the property hidden when debugging because the context can get pretty large. Most of the time this is fine, but in the case of passing an array of views to the each helper, the context of the helpers inside the body of the each ends up being an individual view/item. Since these instances have a get and set method on them, define-property sees that as an access-descriptor and sets it like a getter instead of a value. So when the .context was called, it was actually calling a different method than expected.

from assemble.

criticalmash avatar criticalmash commented on May 29, 2024

Alright, thanks. Always amazed when a take a deeper look into assemble and see something new.

BTW: how can I be notified when new releases are out?

from assemble.

jonschlinkert avatar jonschlinkert commented on May 29, 2024

The context is added to an internal object using define-property to make the property hidden when debugging because the context can get pretty large

fwiw, this is mostly done to prevent circular references from being merged onto the context

from assemble.

doowb avatar doowb commented on May 29, 2024

@criticalmash if you clear your node modules and install again, you should get the latest dependencies containing the bugfix. Let me know if it works, then we can close this.

BTW: how can I be notified when new releases are out?

Right now, the best way is to watch the repositories and follow us to see our activity. You can also follow us and assemble on twitter. We'll try to tweet major releases.

from assemble.

jonschlinkert avatar jonschlinkert commented on May 29, 2024

Doesn't github show activity when you watch a repository?

from assemble.

doowb avatar doowb commented on May 29, 2024

That's what I mean by "follow the projects". I edited it to say "watch the repositories".

from assemble.

criticalmash avatar criticalmash commented on May 29, 2024

OK, it took me a couple of tries but I now have [email protected] installed. Working great now.

Thanks for all your help.

from assemble.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.