ScottLogic / prompt-injection

Application which investigates defensive measures against prompt injection attacks on an LLM, with a focus on the exposure of external tools.
MIT License
11 stars 9 forks source link

862 Cleanup dialog opening/closing, remove click away to close behaviour #866

Closed chriswilty closed 3 months ago

chriswilty commented 3 months ago

Description

There were a couple of timing-related bugs in the code, mostly due to HTMLDialogElement throwing an error if you try to open a dialog when it's already open. This was happening due to some convoluted logic in the sequence of events from Reset All Progress dialog to Welcome dialog to Mission Info dialog, including some useEffect side-effects on component update. I've simplified the logic, but also needed to remove the "click away to close dialog" behaviour, because it was causing an unrecoverable problem in which more than one click handler could become bound to the window, causing some dialogs to close as soon as they'd opened.

Resolves #862

Notes

Checklist

Have you done the following?

chriswilty commented 3 months ago

Just rebased, but am going to verify bug is still fixed as some of the logic was moved between components.

chriswilty commented 3 months ago

Rebased and verified still working ok.