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

Error while apply() inside match #309

Closed
Yeti-or opened this issue Jul 7, 2016 · 11 comments · Fixed by #401
Closed

Error while apply() inside match #309

Yeti-or opened this issue Jul 7, 2016 · 11 comments · Fixed by #401

Comments

@Yeti-or
Copy link
Member

Yeti-or commented Jul 7, 2016

I don't think that it is good pattern but when you try to use apply inside match u get an Error:
example

Maybe we need to handle this error and continue to process template, or fix this.

@miripiruni
Copy link
Contributor

miripiruni commented Sep 5, 2016

We need a guard against recursion deadlock.

@golyshevd
Copy link

Another example https://goo.gl/EbKDW3

@miripiruni
Copy link
Contributor

@golyshevd thank you. In current bem-xjst you can not use apply() in match().

@golyshevd
Copy link

@miripiruni why not? is it feature? )

@miripiruni
Copy link
Contributor

@golyshevd it happened :) I’ll try to fix it.

@golyshevd
Copy link

@miripiruni Thanks!

@remnev
Copy link

remnev commented Jan 10, 2017

Guys, let's resurrect this issue. We encountered this problem again.

@miripiruni
Copy link
Contributor

@remnev can you show your usecase please?

@golyshevd
Copy link

block('foo')(
    mode('is-empty')(true),
    content()(
      match(() => !apply('is-empty'))('text')
    )
);

@remnev
Copy link

remnev commented Jan 10, 2017

For example, I have a mode, which returns some data or nothing. Depends on it I want to output different content.

// one case: returns "text"
block('foo')(
    mode('is-empty')(true),
    content()(
      '–',
      match(() => apply('is-empty'))('text')
    )
);

// another case: returns "–"
block('foo').mod('a', 'b')(
    mode('is-empty')(false)
);

@miripiruni
Copy link
Contributor

@remnev thanks.

@miripiruni miripiruni added this to the 8.6.1 milestone Feb 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants