From 9ba79cfb32a6c10ac49ff86869b47e86a518ad5e Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Mon, 29 Jun 2020 19:39:26 -0700 Subject: [PATCH] Fix infinite loop when postinstall has
in it --- src/js/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/js/index.js b/src/js/index.js index 016a19956..202c78e1d 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -394,8 +394,13 @@ app.filter('markdown2html', function () { tables: true }); + // without this cache, the code runs into some infinite loop (https://github.com/angular/angular.js/issues/3980) + var cache = {}; + return function (text) { - return converter.makeHtml(text); + if (cache[text]) return cache[text]; + cache[text] = converter.makeHtml(text); + return cache[text]; }; });