@contentful/experiences-visual-editor-react 1.0.6-dev-20240416T2113-090181e.0 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2768,6 +2768,23 @@ const resolveAssembly = ({ node, entityStore, }) => {
2768
2768
  return deserializedNode;
2769
2769
  };
2770
2770
 
2771
+ class ImportedComponentError extends Error {
2772
+ constructor(message) {
2773
+ super(message);
2774
+ this.name = 'ImportedComponentError';
2775
+ }
2776
+ }
2777
+ class ImportedComponentErrorBoundary extends React.Component {
2778
+ componentDidCatch(error, _errorInfo) {
2779
+ const err = new ImportedComponentError(error.message);
2780
+ err.stack = error.stack;
2781
+ throw err;
2782
+ }
2783
+ render() {
2784
+ return this.props.children;
2785
+ }
2786
+ }
2787
+
2771
2788
  const useComponent = ({ node: rawNode, resolveDesignValue, renderDropzone, userIsDragging, }) => {
2772
2789
  const areEntitiesFetched = useEntityStore((state) => state.areEntitiesFetched);
2773
2790
  const entityStore = useEntityStore((state) => state.entityStore);
@@ -2809,7 +2826,7 @@ const useComponent = ({ node: rawNode, resolveDesignValue, renderDropzone, userI
2809
2826
  : node.type === ASSEMBLY_NODE_TYPE
2810
2827
  ? // Assembly.tsx requires renderDropzone and editorMode as well
2811
2828
  () => React.createElement(componentRegistration.component, componentProps)
2812
- : () => React.createElement(componentRegistration.component, otherComponentProps);
2829
+ : () => React.createElement(ImportedComponentErrorBoundary, null, React.createElement(componentRegistration.component, otherComponentProps));
2813
2830
  return {
2814
2831
  node,
2815
2832
  componentId,