()
| 7 | import { useSettingsChange } from '../useSettingsChange.js'; |
| 8 | const SETTINGS_ERRORS_NOTIFICATION_KEY = 'settings-errors'; |
| 9 | export function useSettingsErrors() { |
| 10 | const $ = _c(6); |
| 11 | const { |
| 12 | addNotification, |
| 13 | removeNotification |
| 14 | } = useNotifications(); |
| 15 | const [errors_0, setErrors] = useState(_temp); |
| 16 | let t0; |
| 17 | if ($[0] === Symbol.for("react.memo_cache_sentinel")) { |
| 18 | t0 = () => { |
| 19 | const { |
| 20 | errors: errors_1 |
| 21 | } = getSettingsWithAllErrors(); |
| 22 | setErrors(errors_1); |
| 23 | }; |
| 24 | $[0] = t0; |
| 25 | } else { |
| 26 | t0 = $[0]; |
| 27 | } |
| 28 | const handleSettingsChange = t0; |
| 29 | useSettingsChange(handleSettingsChange); |
| 30 | let t1; |
| 31 | let t2; |
| 32 | if ($[1] !== addNotification || $[2] !== errors_0 || $[3] !== removeNotification) { |
| 33 | t1 = () => { |
| 34 | if (getIsRemoteMode()) { |
| 35 | return; |
| 36 | } |
| 37 | if (errors_0.length > 0) { |
| 38 | const message = `Found ${errors_0.length} settings ${errors_0.length === 1 ? "issue" : "issues"} · /doctor for details`; |
| 39 | addNotification({ |
| 40 | key: SETTINGS_ERRORS_NOTIFICATION_KEY, |
| 41 | text: message, |
| 42 | color: "warning", |
| 43 | priority: "high", |
| 44 | timeoutMs: 60000 |
| 45 | }); |
| 46 | } else { |
| 47 | removeNotification(SETTINGS_ERRORS_NOTIFICATION_KEY); |
| 48 | } |
| 49 | }; |
| 50 | t2 = [errors_0, addNotification, removeNotification]; |
| 51 | $[1] = addNotification; |
| 52 | $[2] = errors_0; |
| 53 | $[3] = removeNotification; |
| 54 | $[4] = t1; |
| 55 | $[5] = t2; |
| 56 | } else { |
| 57 | t1 = $[4]; |
| 58 | t2 = $[5]; |
| 59 | } |
| 60 | useEffect(t1, t2); |
| 61 | return errors_0; |
| 62 | } |
| 63 | function _temp() { |
| 64 | const { |
| 65 | errors |
no test coverage detected