@tramvai/react 2.103.1 → 2.104.2

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.
@@ -6,11 +6,11 @@ type AnyError = Error & {
6
6
  [key: string]: any;
7
7
  };
8
8
  export interface UniversalErrorBoundaryFallbackProps {
9
- url: Url;
10
9
  error: AnyError;
10
+ url?: Url;
11
11
  }
12
12
  export interface UniversalErrorBoundaryProps {
13
- url: Url;
13
+ url?: Url;
14
14
  error?: AnyError | null;
15
15
  fallback?: React.ComponentType<UniversalErrorBoundaryFallbackProps>;
16
16
  errorHandlers?: ExtractDependencyType<typeof ERROR_BOUNDARY_TOKEN> | null;
@@ -22,13 +22,16 @@ export interface UniversalErrorBoundaryProps {
22
22
  }
23
23
  interface State {
24
24
  error: AnyError | null;
25
- url: Url;
25
+ url?: Url;
26
26
  }
27
27
  type Props = UniversalErrorBoundaryProps;
28
28
  export declare class UniversalErrorBoundary extends Component<Props, State> {
29
29
  constructor(props: Props);
30
30
  static displayName: string;
31
31
  static getDerivedStateFromProps(props: Props, state: State): {
32
+ error: AnyError | null;
33
+ url?: undefined;
34
+ } | {
32
35
  error: AnyError | null;
33
36
  url: Url;
34
37
  };
@@ -12,6 +12,9 @@ class UniversalErrorBoundary extends Component {
12
12
  }
13
13
  // Reference and explanation here - https://github.com/remix-run/remix/blob/main/packages/remix-react/errorBoundaries.tsx#L35
14
14
  static getDerivedStateFromProps(props, state) {
15
+ if (props.url === undefined) {
16
+ return { error: props.error || state.error };
17
+ }
15
18
  if (props.url !== state.url) {
16
19
  return { error: props.error || null, url: props.url };
17
20
  }
@@ -16,6 +16,9 @@ class UniversalErrorBoundary extends react.Component {
16
16
  }
17
17
  // Reference and explanation here - https://github.com/remix-run/remix/blob/main/packages/remix-react/errorBoundaries.tsx#L35
18
18
  static getDerivedStateFromProps(props, state) {
19
+ if (props.url === undefined) {
20
+ return { error: props.error || state.error };
21
+ }
19
22
  if (props.url !== state.url) {
20
23
  return { error: props.error || null, url: props.url };
21
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/react",
3
- "version": "2.103.1",
3
+ "version": "2.104.2",
4
4
  "description": "",
5
5
  "main": "lib/react.js",
6
6
  "typings": "lib/react.d.ts",
@@ -19,7 +19,7 @@
19
19
  "dependencies": {
20
20
  "@loadable/component": "^5.15.2",
21
21
  "@types/loadable__component": "^5.13.4",
22
- "@tramvai/types-actions-state-context": "2.103.1",
22
+ "@tramvai/types-actions-state-context": "2.104.2",
23
23
  "hoist-non-react-statics": "^3.3.0"
24
24
  },
25
25
  "peerDependencies": {