UID refactor 4/ Expose readonly UIState

Summary:
Currently state writes can either go through a named handler that is easy to find and debug or they can directly modify the state.

By exposing readonly atoms only we ensure that all state writes go through a UIACtions. This adds consistency and ease of future debugging.

E.g We could add a utility to wrap all ui actions with logging statements

Reviewed By: antonk52

Differential Revision: D47547531

fbshipit-source-id: f88651169d8e7c5f7e31068d64f9aa5b6b573647
This commit is contained in:
Luke De Feo
2023-07-21 07:17:31 -07:00
committed by Facebook GitHub Bot
parent 87a1b657c3
commit 957a336349
7 changed files with 86 additions and 69 deletions

View File

@@ -39,7 +39,7 @@ export const UIDebuggerMenuItem: React.FC<{
disabled={onClick == null}
onClick={() => {
onClick?.();
instance.uiState.isContextMenuOpen.set(false);
instance.uiActions.onContextMenuOpen(false);
}}>
<Layout.Horizontal center gap="small">
{icon}