With the introduction of v. 0.33.0, mapping to this.Parameter is not functioning correctly. It is firing multiple times instead of once in this case.
Steps to Recreate:
Checkout the hikr tutorial app: https://github.com/fusetools/hikr
EditHikePage.js
var Context = require("Modules/Context");
var hike = this.Parameter;
var name = hike.map(function(x) { return x.name; }); //This line fires once with the name
var location = hike.map(function(x) { return x.location; });
var distance = hike.map(function(x) { return x.distance; });
var rating = hike.map(function(x) { return x.rating; });
var comments = hike.map(function(x) { return x.comments; });
var formattedName = name.map(function(theName){
console.log(theName); //This line fires twice
return theName;
});
function cancel() {
// Refresh hike value to reset dependent Observables' values
hike.value = hike.value;
router.goBack();
}
function save() {
Context.updateHike(hike.value.id, name.value, location.value, distance.value, rating.value, comments.value);
router.goBack();
}
module.exports = {
name: name,
location: location,
distance: distance,
rating: rating,
comments: comments,
formattedName,
cancel: cancel,
save: save
};
Basically the only additions are the formattedName observable (and including the observable in the module.export).
It appears on Windows local preview. In the Hikr app, it fires 2 times. The hike.map(function(x) { return x.name; });
only fires once however.