( updatedVersion: string | null | undefined, initialVersion: string = MACRO.VERSION, )
| 14 | } |
| 15 | |
| 16 | export function useUpdateNotification( |
| 17 | updatedVersion: string | null | undefined, |
| 18 | initialVersion: string = MACRO.VERSION, |
| 19 | ): string | null { |
| 20 | const lastNotifiedRef = useRef<string | null>(getSemverPart(initialVersion)) |
| 21 | |
| 22 | const updatedSemver = updatedVersion ? getSemverPart(updatedVersion) : null |
| 23 | if (!updatedSemver) { |
| 24 | return null |
| 25 | } |
| 26 | |
| 27 | if (updatedSemver !== lastNotifiedRef.current) { |
| 28 | lastNotifiedRef.current = updatedSemver |
| 29 | return updatedSemver |
| 30 | } |
| 31 | |
| 32 | return null |
| 33 | } |
no test coverage detected