UUDigitalHumanitieslab / I-analyzer

The great textmining tool that obviates all others
https://ianalyzer.hum.uu.nl
MIT License
6 stars 2 forks source link

Endless `formatInnerHtml` loop #1543

Closed BeritJanssen closed 3 days ago

BeritJanssen commented 2 months ago

What went wrong?

During debugging for #956 I put a breakpoint in document-view.component.formatInnerHtml, and noticed that the template keeps triggering the function, so that every field is processed endlessly. The call stack indicates that the RouterStoreService is responsible. We still seem to have a feedback loop.

Screenshot 2024-04-12 at 15 02 47

What did you expect to happen?

I expect that this function would be triggered once for each field.

Screenshot

No response

Where did you find the bug?

Version

develop

Steps to reproduce

Start up I-Analyzer, navigate to a corpus, put a breakpoint on line 108 of document-view.component.ts, and open a document view.

lukavdplas commented 2 months ago

Strange, I can see the repeated calls to formatInnerHTML, but I can't find any repeated calls within RouterStoreService. Can you give more information about what you noticed there?

BeritJanssen commented 2 months ago

I did some experimentation, and contrary to my first diagnosis (which also didin't bring up any insights when I put breakpoints further down the callstack), the problem seems to have been caused by change detection going awry. It looks as if a custom pipe solves the problem. Will do some refactoring.