Skip to content

Fix NotificationTemplate Add error - #518

Merged
cigamit merged 2 commits into
mainfrom
260625-notifcation
Jun 25, 2026
Merged

Fix NotificationTemplate Add error#518
cigamit merged 2 commits into
mainfrom
260625-notifcation

Conversation

@cigamit

@cigamit cigamit commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

The crash happened because the effect read defs.started while defs (i.e. defaultMessages[type]) was undefined — type is '' on the Add form, and under React 18 StrictMode the effect re-runs on mount, bypassing the mountedRef guard. Added an early if (!defs) return; so the reset logic only runs once a valid notification type is selected.

@cigamit
cigamit requested a review from TheWitness June 25, 2026 17:13
@cigamit cigamit self-assigned this Jun 25, 2026
Copilot AI review requested due to automatic review settings June 25, 2026 17:13
@cigamit cigamit added bug Something isn't working javascript Pull requests that update javascript code labels Jun 25, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a crash in the Notification Template “Add” flow by preventing the custom-messages reset effect from dereferencing missing defaults when the notification type is still empty ('') under React 18 StrictMode.

Changes:

  • Adds a defensive guard to exit the reset effect early when defaultMessages[type] is undefined.
  • Prevents StrictMode’s double-invoked mount effect from crashing before a valid notification type is selected.

Comment thread awx/ui/src/screens/NotificationTemplate/shared/CustomMessagesSubForm.js Outdated
@cigamit
cigamit merged commit 85fe6ba into main Jun 25, 2026
@cigamit
cigamit deleted the 260625-notifcation branch June 25, 2026 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working javascript Pull requests that update javascript code

Development

Successfully merging this pull request may close these issues.

3 participants