Skip to content

fix(api-service): In-app step redirect error#10046

Draft
scopsy wants to merge 2 commits intonextfrom
cursor/NV-7104-in-app-step-redirect-error-00aa
Draft

fix(api-service): In-app step redirect error#10046
scopsy wants to merge 2 commits intonextfrom
cursor/NV-7104-in-app-step-redirect-error-00aa

Conversation

@scopsy
Copy link
Contributor

@scopsy scopsy commented Feb 15, 2026

What changed? Why was the change needed?

This PR resolves NV-7104, where the in-app step redirect URL target would reset and show persistent validation errors.

The issue stemmed from a combination of factors:

  1. Shallow merging of default control values, which caused nested properties like redirect.target to be lost if the incoming controlValues had a partial redirect object.
  2. React Hook Form's values prop not being initialized with fully merged default values, leading to resets losing nested fields.
  3. The sanitizeRedirect function not consistently providing a default target when a redirect URL was present.

To address this, the following changes were made:

  • Introduced a deepMergeDefaults utility to correctly merge nested default values.
  • Updated EditStepTemplateV2Page to use the deeply merged defaultValues for React Hook Form's values prop.
  • Added a fallback and useEffect to URLInput to ensure the target always defaults to _self if undefined.
  • Modified sanitizeRedirect to explicitly set target to _self for relative URLs and _blank for absolute URLs if it's missing.

Screenshots


Linear Issue: NV-7104

Open in Cursor Open in Web

- Use deep merge in getControlsDefaultValues to preserve nested defaults
  like redirect.target when controlValues has a partial redirect object
- Change EditStepTemplateV2Page to use defaultValues (which includes
  deep-merged server values + UI schema defaults) as the values prop
  to prevent React Hook Form resets from losing nested field values
- Add useEffect fallback in URLInput to restore target to first option
  when value becomes undefined, and use fallback in Select value prop
- Fix sanitizeRedirect to default target based on URL type (relative
  paths get _self, absolute URLs get _blank) when target is missing

Fixes NV-7104

Co-authored-by: Dima Grossman <dima@grossman.io>
@cursor
Copy link
Contributor

cursor bot commented Feb 15, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@linear
Copy link

linear bot commented Feb 15, 2026

@netlify
Copy link

netlify bot commented Feb 15, 2026

Deploy preview added

Name Link
🔨 Latest commit b53c4d8
🔍 Latest deploy log https://app.netlify.com/projects/dashboard-v2-novu-staging/deploys/699f1abb50ae280008c38a9c
😎 Deploy Preview https://deploy-preview-10046.dashboard-v2.novu-staging.co
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 15, 2026

Hey there and thank you for opening this pull request! 👋

We require pull request titles to follow specific formatting rules and it looks like your proposed title needs to be adjusted.

Your PR title is: fix(api-service): In-app step redirect error

Requirements:

  1. Follow the Conventional Commits specification
  2. As a team member, include Linear ticket ID at the end: fixes TICKET-ID or include it in your branch name

Expected format: feat(scope): Add fancy new feature fixes NOV-123

Details:

PR title must end with 'fixes TICKET-ID' (e.g., 'fixes NOV-123') or include ticket ID in branch name

@scopsy scopsy changed the title In-app step redirect error fix(api-service): In-app step redirect error Feb 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants