I'm submitting a pull request to refine the mergeData function in pattern_assembler.js. The short description is so that pattern~variant.json files behave as they do in patternlab-php.
As it stands, in patternlab-node, the data in the 2nd param overwrites the data in the 1st param, which in most cases, is what you want. However, this is problematic in pseudopattern_hunter.js, because the 1st param is variantFileData. What this means is that if a variant data property has the same key as the primary pattern's, the variant will show what's assigned to the primary pattern.
As an example, say 00-homepage~emergency.json had a property "title" with value "Emergency". 00-homepage~emergency's title will be "Home Page" and not "Emergency". Simply reversing the parameter order won't fix things because then, the non-emergency 00-homepage will show the emergency block.
In order to fix this, I had to reverse the order of parameters in pseudopattern_hunter.js. I then had to update the mergeData function in pattern_assembler.js so it checks that the parameter in obj2 is undefined before copying the value over from ob1.
I'm submitting a pull request to refine the mergeData function in
pattern_assembler.js. The short description is so thatpattern~variant.jsonfiles behave as they do in patternlab-php.As it stands, in patternlab-node, the data in the 2nd param overwrites the data in the 1st param, which in most cases, is what you want. However, this is problematic in
pseudopattern_hunter.js, because the 1st param isvariantFileData. What this means is that if a variant data property has the same key as the primary pattern's, the variant will show what's assigned to the primary pattern.As an example, say
00-homepage~emergency.jsonhad a property "title" with value "Emergency". 00-homepage~emergency's title will be "Home Page" and not "Emergency". Simply reversing the parameter order won't fix things because then, the non-emergency 00-homepage will show the emergency block.In order to fix this, I had to reverse the order of parameters in
pseudopattern_hunter.js. I then had to update themergeDatafunction inpattern_assembler.jsso it checks that the parameter in obj2 is undefined before copying the value over from ob1.