[JSMODELS-6] Bad type when passing a returned js object to another js function Created: 17/May/17  Updated: 07/Jun/17  Resolved: 31/May/17

Status: Closed
Project: Magnolia Javascript Models
Component/s: None
Affects Version/s: None
Fix Version/s: 1.0

Type: Bug Priority: Major
Reporter: Christopher Zimmermann Assignee: Jaroslav Simak
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to JSMODELS-4 Provide samples of how to use JS models Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Epic Link: LD: Fundamental features
Sprint: Kromeriz 99
Story Points: 1

 Description   

If you pass returned javascript object (array, json) to the model, it's type gets changed and it does not behave as it should if you pass it again to another model function.

To reproduce:

  1. Return an JS array from a model function.
  2. Pass the returned array to another model function.

(Problem is not just with arrays though.)

Result:

  • It cannot be iterated with for(var item in input) {
  • It cannot be iterated with for each (item in input){
  • it does not have a length.

From Jaroslav:
It's something related to freemarker template object wrapping, so fixing it might be a little bit tricky.


Generated at Mon Feb 12 05:58:43 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.