Jump to content

Topic on Extension talk:Flex Diagrams

Tenbergen (talkcontribs)

I have been running this on one wiki where it works great, and just installed it on another one where I can't save Drawios. Both run php 8.1.27 , FlexDiagrams 0.5.2 (2d8d4a3) 02:28, 2024 April 22, MW1.41.1. If I click the save button on the editor, initially nothing happens. When I click it again, the spinny disk comes up but it stays there (it's a small one, when the save works right on the initial wiki it's a bigger spinny disk). If I click "save page" at the bottom it ask me if I really want to leave, it clearly doesn't finish the editor safe. If I say yes it saves a page that then doesn't let me back into the editor, I have to delete the page and start over. I enabled debugging and found the following errors:

Failed to register/update a ServiceWorker for scope ‘https://embed.diagrams.net/’: Storage access is restricted in this context due to user settings or private browsing mode.  

and

Uncaught (in promise) DOMException: The operation is insecure.
   main https://embed.diagrams.net/js/app.min.js:12979
   checkAllLoaded https://embed.diagrams.net/?embed=1&spin=1&proto=json:247
   <anonymous> https://embed.diagrams.net/?embed=1&spin=1&proto=json:458

and

 Source map error: request failed with status 404
Resource URL: https://embed.diagrams.net/js/app.min.js
Source Map URL: purify.min.js.map 

These show up on both wikis, though. Actually, the one that works gets one more line of error under uncaught promise:

EventListener.handleEvent* https://embed.diagrams.net/?embed=1&spin=1&proto=json:455

Any suggestions how I would troubleshoot that?

Yaron Koren (talkcontribs)

Hi! Which browser(s) does this occur with? And do you have any special privacy setting for those browser(s)?

Tenbergen (talkcontribs)

Nothing in the console, even with full debugging. Firefox with ublock disabled; tried edge with no blockers, same thing. And it wasn't working with that yesterday, but now it does. Or did. Once or twice. Back to troubleshooting...

Tenbergen (talkcontribs)

Still having the problem. Found out one additional thing. When I try to edit a page that already exists I don't get the "asking you to confirm that you want to leave" error, but the page doesn't actually get saved, either. Found a few messages that aren't necessarily errors:

[ActionFactory] editdiagram is being set in configuration rather than CORE_ACTIONS
[ActionFactory] editdiagram is being set in configuration rather than CORE_ACTIONS
[ActionFactory] Overriding normal handler for editdiagram
[ActionFactory] editdiagram is being set in configuration rather than CORE_ACTIONS
[ActionFactory] Overriding normal handler for editdiagram
Yaron Koren (talkcontribs)

That's strange; I don't know. Unrelated question: are you able to save diagrams of a type other than Drawio/diagrams.net on that wiki?

Tenbergen (talkcontribs)

I just added a mermaid diagram, and I was able to add it and then edit it later.

Yaron Koren (talkcontribs)

Alright, that's good to know. So, as for Drawio, sometimes it does work? In both browsers you tried?

Tenbergen (talkcontribs)

It must have worked at least once, since I have one page that has a diagram in it. Tonight I tried in firefox and was able to make a new page that has a diagram in it, and save that, but when I try to edit the changes are not saved. So, for this the data isn't updated, but what is there is shown right. Then I tried in edge and got the "changes you made may not be saved". It actually shows the "text" data for the form, and if I copy-paste that text into a different wiki with working Drawio, it displays it as a diagram. If I then click the "edit diagram" tab again for a page where the diagram won't show, the editor doesn't show. For this it's almost like it can't reach the service but the data is stored right. Having said that, I have had the problem that happens in Edge tonight on Firefox over the last few days, so I don't really think this is necessarily a browser difference.

Tenbergen (talkcontribs)

I played with this some more tonight... It appears that the new text code actually gets saved, just the image isn't being updated. When I make an edit and save, the same image stays. When I paste the text to a different wiki where drawio works, it corresponds to the edited version. Also, if I move the page to a different page name, the image on that moved page is then the one I saved. Weird.

Yaron Koren (talkcontribs)

Oh, interesting - it sounds like your server is possibly just caching Drawio diagrams too aggressively. There may be some web server configuration you can change to fix this; I don't know.

Tenbergen (talkcontribs)

Interesting thought. I have been working with support from my shared host for the last week or so because crontab is re-running old jobs that have long been deleted and/or updated. Your suggestion makes me wonder if the two might be related. Flexforms and DrawIO work fine on a different account with the same host that doesn't have crontab craziness. I have sent that to support, we'll see if that gets me anywhere.

Tenbergen (talkcontribs)

I have moved the wiki to be hosted on our own server, and still get the problem with saving. I now wonder if this has to do with one of the other extensions that are installed.

Yaron Koren (talkcontribs)

I looked into this a little too - I had forgotten this, but when displaying Mermaid diagrams, the Flex Diagrams code sets $wgResourceLoaderDebug to true, to stop caching of their display - see here. If possible, could you try adding that same code to the handling of Drawio diagrams, right above it, to see if that improves the situation?

Tenbergen (talkcontribs)

I changed line 61 from

global $wgOut;

to

global $wgOut, $wgResourceLoaderDebug;

It didn't fix the problem. Was it meant to fix the problem or to provide more info about it? I don't know what adding $wgResourceLoaderDebug is supposed to do. Also, that class's description says it's for the parser function, but this is a problem even on the drawio: namespace page.

Yaron Koren (talkcontribs)

Okay - there are various errors here, but it doesn't really matter because it turns out that turning on debug mode is being done to get the JavaScript to load correctly, not to disable caching. So I'm back to not knowing - clearly it's a caching issue, but I don't know how to fix it.

Reply to "Can't save"