markbind icon indicating copy to clipboard operation
markbind copied to clipboard

Mermaid Script CORS issue

Open gerteck opened this issue 8 months ago • 3 comments

Please confirm that you have searched existing issues in the repo

Yes, I have searched the existing issues

Any related issues?

No response

Tell us about your environment

Win 11

MarkBind version

5.6.0

Describe the bug and the steps to reproduce it

On the left is Vue3, right is Vue2. There seem to be a little issue with the rendering of the mermaid diagram.

Originally posted by @IanCheah in https://github.com/MarkBind/markbind/issues/2622#issuecomment-2764379082

Here is a screenshot:

Sometimes there is the CORS issue (left), sometimes there is no CORS issue (right). Both screenshots were taken of the same page at different times. Seems to be flaky.

Image

https://markbind-master.netlify.app/userguide/components/imagesanddiagrams#mermaid-diagrams

Expected behavior

Should work.

Anything else?

Seems to be quite a concerning regression actually, not sure why this is the case and why it was only spotted so late on by @IanCheah.

However, since it is a CORS issue, if we directly support offline loading (#2548) and bundle it together it should totally resolve the issue.

gerteck avatar Mar 30 '25 15:03 gerteck

I think this might be an unpkg issue, not a regression from the Vue migration.

I've tried a bunch of times and haven't seen the error.

From the screenshot, I think it might be that the unpkg had some internal problem, returning the 500 error message without the CORS header, and that's why we got the CORS error.

Either way, bundling the unpkg seems like the right thing to do here.

Tim-Siu avatar Apr 10 '25 08:04 Tim-Siu

@lhw-1 This issue should be resolved before we release v6, right?

damithc avatar Apr 13 '25 14:04 damithc

@damithc It seems that the issue might not be related to the Vue 3 migration; see this issue on unpkg, where similar issues occurred across all the packages using unpkg. From what I can tell, this issue just happened to overlap in time with our Vue 3 migration testing, so this issue was not necessary to be solved for v6. Hence the suggestion by @Tim-Siu.

They have reported that the issue with unpkg was potentially caused by an internal migration that unpkg also happened to be working on, and it has since been resolved, so the issue shouldn't re-occur.

I guess the question would be, should we bundle unpkg? If this is a one-time issue with unpkg, I'm not sure if we can justify bundling it for the sake of the CORS issue. The bundling for mermaid just to support offline functionalities is still an open issue under #2548, so we could potentially move the discussion there instead and close this issue.

lhw-1 avatar Apr 13 '25 15:04 lhw-1