Why "hidden" link is not honoured in this diagram?

0 votes
asked Jan 14, 2022 in Bug by mcon (320 points)
recategorized Jan 18, 2022 by mcon

I have a diagram where I have several parallel never-ending tasks; I tried the following to hide the "partial arrow":

@startuml
start
fork
    while (loop forever)
        :Button poll;
        if (pressed) then
            :debounce;
        else
            if (was_pressed)
                if (duration > 2s)
                    if (duration > 8s)
                        if (duration < 10s)
                            :generate long press;
                        endif
                    else
                        :generate short press;
                    endif
                endif
            endif
        endif
    endwhile
    -[hidden]->
    detach

fork again
    while (loop forever)
        : wait for press;
        : handle press;
    endwhile
    -[hidden]->
    detach
    
fork again
    : Bluetooth handling;
    detach

fork again
    : Battery charger;
    detach

fork again
    : Battery monitor;
    detach

@enduml

but apparently this is not honored.

What am I doing wrong?

commented Jan 14, 2022 by Martin (9,120 points)
edited Jan 14, 2022 by Martin

I agree that the trick to detach and hide to make an infinite while loop doesn't work inside a fork.  Here is a comparison of the two:

without fork - OKwith fork - KO
@startuml
while (loop forever)
   :Step 2;
  endwhile
  -[hidden]->
  detach
@enduml
@startuml
fork
while (loop forever)
   :Step 2;
  endwhile
  -[hidden]->
  detach
end fork
@enduml

And here's another example using colour instead of detach/hidden:

without fork - OKwith fork - KO
@startuml
while (loop forever)
   :Step 2;
  endwhile
  -[#blue]-> blue;
  :A;
  -[#green]-> green;
  :B;
@enduml
@startuml
fork
while (loop forever)
   :Step 2;
  endwhile
  -[#blue]-> blue;
  :A;
  -[#green]-> green;
  :B;
end fork
@enduml

commented Jan 18, 2022 by mcon (320 points)
Thanks Martin.

I assume this means we should change from "Question / help" to "Bug", right?

Is there any workaround?

Having several parallel never-ending tasks is not "uncommon" ;)

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

[Antispam2 Feature: please please wait 1 or 2 minutes (this message will disappear) before pressing the button otherwise it will fail](--------)
To avoid this verification in future, please log in or register.
...