structurizr / ui

UI code for Structurizr Lite, on-premises, and cloud service.
https://docs.structurizr.com/ui
MIT License
43 stars 27 forks source link

Examples need to wait for themes to load #1

Closed phxnsharp closed 1 year ago

phxnsharp commented 1 year ago

In order for documents to draw correctly, you need to wait for the themes to load before loading the diagram.

https://github.com/structurizr/ui/blob/ab04e8982bb7e3d016b30dc48dd1e21890b30333/examples/diagram-basic.html#L34

    $.ajax({url: 'https://raw.githubusercontent.com/structurizr/ui/main/examples/big-bank-plc.json',
    success: function(data){
        structurizr.workspace = new structurizr.Workspace(JSON.parse(data));
        structurizr.ui.loadThemes(function() {
            const diagram = new structurizr.ui.Diagram('diagram', false, function() {
                diagram.changeView('Containers');
            });
        });
    }});
});
simonbrowndotje commented 1 year ago

This shouldn't be the case ... https://raw.githubusercontent.com/structurizr/ui/main/examples/big-bank-plc.json has no themes.

phxnsharp commented 1 year ago

Add a person to the diagram. The person will show as a box instead of person unless you do this.

simonbrowndotje commented 1 year ago

The Containers diagram in that example already has a person on it.

Screenshot 2023-02-03 at 13 44 38

Is this a problem with a workspace of your own, or does the examples/diagram-basic.html file in the repo not work for you?

phxnsharp commented 1 year ago

I do not reproduce the problem in the sample repo here. I am using this from a Hugo static site, so the race condition must be quite different. I do not at this time have a reproduction recipe I can share. If I have time I can try to create one.