Giter Club home page Giter Club logo

Comments (12)

jimmyhchan avatar jimmyhchan commented on June 24, 2024

Thanks for reporting and thanks for the simplified example! investigating.

from dustjs-helpers.

jimmyhchan avatar jimmyhchan commented on June 24, 2024

actually. can you elaborate on structure of data.

is it

{data: [{messages: ['a','b','c']},{messages: ['a','b','c']},{messages: ['a','b','c']}]}

or do yo have some nested thing with multiple "data" properties.

from dustjs-helpers.

jimmyhchan avatar jimmyhchan commented on June 24, 2024

seems to be related to eb10839. I'm still trying to get this reproduced.

from dustjs-helpers.

sethkinast avatar sethkinast commented on June 24, 2024

addSelectState seems like it'd be the culprit but we have tests around much of this stuff, so must be an edge case somewhere.

from dustjs-helpers.

jimmyhchan avatar jimmyhchan commented on June 24, 2024

confirmed the issue. we are dropping the tail context somewhere

here's a simplified test.

works in 1.5
fails in 1.6

+        name:     "select helper inside a array reaching outside",
+        source:   ["{#skills}{@select key=\"{.}\"}",
+                   "{@eq value=\"java\"}JAVA {outside},{/eq}",
+                   "{@eq value=\"js\"}JS {outside},{/eq}",
+                   "{@default value=\"foo\"}UNKNOWN {outside}{/default}",
+                   "{/select}{/skills}"].join("\n"),
+        context:  { "skills" : [ "java", "js" , "unknown"], "outside": 'foo' },
+        expected: "JAVA foo,JS foo,UNKNOWN foo",
+        message: "should test select helper inside a array with {.} and reaches outside"

from dustjs-helpers.

jimmyhchan avatar jimmyhchan commented on June 24, 2024

OK i found the issue.

context.rebase... doesn't do what you think it does. It takes a head and not a tail. the add function is adding a tail into a head which doesn't work.

from dustjs-helpers.

sethkinast avatar sethkinast commented on June 24, 2024

So I want context.stack.tail.head?

from dustjs-helpers.

jimmyhchan avatar jimmyhchan commented on June 24, 2024

nahh it's more annoying then that.

from dustjs-helpers.

sethkinast avatar sethkinast commented on June 24, 2024

There's a possible fix, but I want to look into it a bit more to make sure there aren't more edge cases.

from dustjs-helpers.

sethkinast avatar sethkinast commented on June 24, 2024

Yeah, this isn't enough. {$idx} has problems.

from dustjs-helpers.

sethkinast avatar sethkinast commented on June 24, 2024

There we go.

from dustjs-helpers.

sethkinast avatar sethkinast commented on June 24, 2024

1.6.1 released with a fix. Thank you again for the report!

from dustjs-helpers.

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.