Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(webapp): Handle empty state for webhook settings coming over the wire #3010

Conversation

nalanj
Copy link
Contributor

@nalanj nalanj commented Nov 18, 2024

Describe your changes

When webhook settings come back over the wire as null, which happens when they've never been configured, we were just skipping updating them, which caused stale data from an environment change in the UI. This fixes that!

Issue ticket number and link

https://linear.app/nango/issue/NAN-2104/inconsistent-environment-settings-values-when-switching-environments

Checklist before requesting a review (skip if just adding/editing APIs & templates)

  • I added tests, otherwise the reason is:
  • I added observability, otherwise the reason is:
  • I added analytics, otherwise the reason is:

@nalanj nalanj self-assigned this Nov 18, 2024
Copy link

linear bot commented Nov 18, 2024

@nalanj nalanj changed the title Handle empty state for webhook settings coming over the wire fix(webapp): Handle empty state for webhook settings coming over the wire Nov 18, 2024
@nalanj nalanj marked this pull request as ready for review November 18, 2024 19:23
@nalanj nalanj requested a review from a team November 18, 2024 19:23
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

would it make sense to have those settings always returned by the api?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@TBonnin I'm pretty sure we could always return them. We would have to either:

  1. pre-set an ExternalWebhook in the DB when we create the environment
  2. remove the id field from the webhook_settings part of the response so we can send an empty state without an id

Technically we could make the id nullable but it seems like it'd be better just to not leak that id since we don't use it to update the webhook anyway.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would be tempted to go for option 2 if we are actually not using this internal id anywhere. Approving but up to you to stick with this frontend change if you prefer this option

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@TBonnin I'll let this sit until tomorrow and we can see what @bodinsamuel says about it. I 100% agree with you about choosing option 2 though.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would go for 1 personally, no changes are required and feels normal to me to pre-populate data

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm going to merge this as-is, and I logged a ticket to come back to for resolving this discussion, but I think this PR solves an existing problem the fastest way we can right now.

@nalanj nalanj enabled auto-merge (squash) November 19, 2024 13:28
@nalanj nalanj merged commit 591f435 into master Nov 19, 2024
19 checks passed
@nalanj nalanj deleted the alan/nan-2104-inconsistent-environment-settings-values-when-switching branch November 19, 2024 13:37
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants