muffin-admin 11.3.0 → 11.4.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muffin-admin",
3
- "version": "11.3.0",
3
+ "version": "11.4.3",
4
4
  "description": "NPM package for https://github.com/klen/muffin-admin",
5
5
  "files": [
6
6
  "src",
@@ -1,12 +1,25 @@
1
1
  import Avatar from "@mui/material/Avatar"
2
+ import CircularProgress from "@mui/material/CircularProgress"
2
3
  import get from "lodash/get"
3
4
  import { useRecordContext } from "ra-core"
4
5
 
5
6
  export function AvatarField({ source, alt, style, nameProp, ...props }) {
6
7
  const record = useRecordContext(props)
7
- const value = get(record, source),
8
+ let value = get(record, source),
8
9
  name = record[nameProp]
9
10
 
11
+ // Check value is a valid URL
12
+ if (value) {
13
+ try {
14
+ new URL(value);
15
+ } catch {
16
+ // Not a valid URL, return loader
17
+ return (
18
+ <CircularProgress size={24} />
19
+ )
20
+ }
21
+ }
22
+
10
23
  const letters = name
11
24
  ? name
12
25
  .trim(" ")
package/src/index.tsx CHANGED
@@ -37,4 +37,4 @@ export async function initAdmin(prefix = "", containerId: string = "root") {
37
37
  )
38
38
  }
39
39
 
40
- export const VERSION = "11.3.0"
40
+ export const VERSION = "11.4.3"