How to use the @keystonejs/utils.captureSuspensePromises function in @keystonejs/utils

To help you get started, we’ve selected a few @keystonejs/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github keystonejs / keystone / packages / app-admin-ui / client / components / ListTable.js View on Github external
{() => {
              // Now that the network request for data has been triggered, we
              // try to initialise the fields. They are Suspense capable, so may
              // throw Promises which will be caught by the above 
              captureSuspensePromises(
                fields
                  .filter(field => field.path !== '_label_')
                  .map(field => () => field.initCellView())
              );

              // NOTE: We don't check for isLoading here because we want to
              // avoid showing the  component when we already
              // have (possibly stale) data to show.
              // Instead, we show the loader when there's _no data at all_.
              if (!items) {
                return (
github keystonejs / keystone / packages / app-admin-ui / client / components / CreateItemModal.js View on Github external
{() => {
                const creatable = list.fields
                  .filter(({ isPrimaryKey }) => !isPrimaryKey)
                  .filter(({ maybeAccess }) => !!maybeAccess.create);

                captureSuspensePromises(creatable.map(field => () => field.initFieldView()));
                return creatable.map((field, i) => (
                  
                    {() => {
                      let [Field] = field.adminMeta.readViews([field.views.Field]);
                      let onChange = useCallback(value => {
                        this.setState(({ item }) => ({
                          item: {
                            ...item,
                            [field.path]: value,
                          },
                          validationErrors: {},
                          validationWarnings: {},
                        }));
                      }, []);
                      return useMemo(
                        () => (
github keystonejs / keystone / packages / app-admin-ui / client / pages / List / index.js View on Github external
{() => {
                  captureSuspensePromises(
                    fields
                      .filter(field => field.path !== '_label_')
                      .map(field => () => field.initCellView())
                  );
                  return ;
                }}