fix: safely executes form state conditions, validations, and default values (#10275)

Whenever form state fails, like when field conditions, validations, or
default value functions throw errors, blocks and array rows are stuck
within an infinite loading state. Examples of this might be when
accessing properties of undefined within these functions, etc. Although
these errors are logged to the server console, the UI is be misleading,
where the user often waits for the request to resolve rather than
understanding that an underlying API error has occurred. Now, we safely
execute these functions within a `try...catch` block and handle their
failures accordingly. On the client, form state will resolve as expected
using the default return values for these functions.
This commit is contained in:
Jacob Fletcher
2025-01-02 14:12:28 -05:00
committed by GitHub
parent 2ae7d8e5d4
commit 7928ecaee7
8 changed files with 87 additions and 43 deletions

View File

@@ -126,6 +126,9 @@ export interface UserAuthOperations {
export interface Post {
id: string;
title?: string | null;
/**
* Hides posts for the `filtered` join field in categories
*/
isFiltered?: boolean | null;
restrictedField?: string | null;
upload?: (string | null) | Upload;
@@ -228,6 +231,9 @@ export interface Category {
docs?: (string | Post)[] | null;
hasNextPage?: boolean | null;
} | null;
/**
* Static Description
*/
hasManyPosts?: {
docs?: (string | Post)[] | null;
hasNextPage?: boolean | null;