From fe20b4d575231c5d8e6f321b57935eb673fd1b00 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Thu, 8 Feb 2024 13:29:08 -0600 Subject: [PATCH] Add note --- src/components/dialogs/README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/components/dialogs/README.md diff --git a/src/components/dialogs/README.md b/src/components/dialogs/README.md new file mode 100644 index 0000000000..cda1242bc6 --- /dev/null +++ b/src/components/dialogs/README.md @@ -0,0 +1,16 @@ +# Global Dialogs + +The dialogs and utils contained in this directory are intended to be "global" in +the sense that they are very common. + +A good example: the report dialog. We need to be able to open one from every +post, but if every post had its own `Dialog`, performance would suffer. +Previously the solution was to use the same modal/sheet via `Modal`, and just +swap out the content. + +The solution here is to only render the dialog when it's opened, and to enable +programmatic opening of said dialog e.g. from a context menu. + +**For other dialogs that can be rendered _in situ_, use `Dialog` directly.** +Only use this abstraction for instances that either aren't possible or would be +performance intensive when defining a `Dialog` in situ.