Skip to content

Commit

Permalink
fix: regression with identical tag name & taglib deduping
Browse files Browse the repository at this point in the history
(cherry picked from commit 3da701c)
  • Loading branch information
DylanPiercey committed Oct 22, 2021
1 parent 1a99697 commit a8d85d7
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 5 deletions.
8 changes: 4 additions & 4 deletions packages/compiler/src/taglib/finder/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ function find(dirname, registeredTaglibs) {
var added = {};

var helper = {
alreadyAdded: function (taglibPath) {
return hasOwnProperty.call(added, taglibPath);
alreadyAdded: function (taglibId) {
return hasOwnProperty.call(added, taglibId);
},
addTaglib: function (taglib) {
if (added[taglib.path]) {
if (added[taglib.id]) {
return;
}

added[taglib.path] = true;
added[taglib.id] = true;
found.push(taglib);
},
foundTaglibPackages: {}
Expand Down
3 changes: 2 additions & 1 deletion packages/compiler/src/taglib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export function buildLookup(dirname, requestedTranslator) {

if (!lookup) {
lookup = lookupCache[cacheKey] = new Lookup();
for (const taglib of taglibsForDir) {
for (let i = taglibsForDir.length; i--; ) {
const taglib = taglibsForDir[i];
lookup.addTaglib(taglib);
if (taglib.imports) {
for (const importedTaglib of taglib.imports) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-- test 3
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<test/>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-- test 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<test/>
<child/>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-- test 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class {}

<div>
<test/>
<child/>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var expect = require("chai").expect;

module.exports = function (helpers) {
var component = helpers.mount(require.resolve("./index"), {});

expect(component.el.textContent).to.equal("test 1test 2test 3");
};

0 comments on commit a8d85d7

Please sign in to comment.