Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix(editor): Create tag when a new workflow tag is selected #9691

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

corneliusludmann
Copy link

Summary

This pull request addresses the issue where saving a workflow with a non-existing tag raises an error (SQLITE_CONSTRAINT: FOREIGN KEY constraint failed for SQLite or insert or update on table "workflows_tags" violates foreign key constraint "fk_workflows_tags_tag_id" for Postgres).

Previously, when a user entered a filter value, the menu offered an option to create a new tag named after the filter value (Create tag "..."). Additionally, the filter value was displayed as the first entry in the tag list, allowing the user to select it directly. However, selecting this item added the tag to the model but did not create it in the database.

image

With this update, both actions—clicking on the "create" menu entry and selecting the new tag—will now consistently create the tag in the database. This ensures that any new tag added via the dropdown menu is properly created and saved.

Additionally, this PR improves the condition for displaying the "create" action item. Previously, it was shown only when the filtered list was empty. Now, it is displayed whenever the filter value does not match an existing tag. While this change is beneficial, it might be better suited for a separate PR. Please let me know if you would like me to separate it.

This change was manually tested based on the issue description #9132. Please let me know if there are recommended ways to write an automated test for this case.

Related tickets and issues

Fixes #9132.

Review / Merge checklist

  • PR title and summary are descriptive. Remember, the title automatically goes into the changelog. Use (no-changelog) otherwise. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.

    A bug is not considered fixed, unless a test is added to prevent it from happening again.
    A feature is not complete without tests.

@CLAassistant
Copy link

CLAassistant commented Jun 10, 2024

CLA assistant check
All committers have signed the CLA.

@corneliusludmann corneliusludmann marked this pull request as ready for review June 10, 2024 16:35
@n8n-assistant n8n-assistant bot added community Authored by a community member ui Enhancement in /editor-ui or /design-system in linear Issue or PR has been created in Linear for internal review labels Jun 10, 2024
Copy link
Contributor

@alexgrozav alexgrozav left a comment

Choose a reason for hiding this comment

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

Hey! Thanks you for your contribution. I've reviewed and manually tested this PR and it works as expected.

The only thing remaining would be adding a small test case. I think an e2e test case would be appropriate here. We have a cypress setup for workflow tags that you can find under cypress/e2e/17-workflow-tags.cy.ts. You can run and develop e2e tests using the pnpm run test:e2e:dev command.

Let me know if you need any help with this.

packages/editor-ui/src/components/TagsDropdown.vue Outdated Show resolved Hide resolved
packages/editor-ui/src/components/TagsDropdown.vue Outdated Show resolved Hide resolved
@corneliusludmann corneliusludmann force-pushed the corneliusludmann/saving-a-workflow-9132 branch from 08aeadc to f0d28cd Compare June 12, 2024 07:39
@corneliusludmann corneliusludmann marked this pull request as draft June 12, 2024 07:39
@corneliusludmann
Copy link
Author

Thanks for the feedback, Alex. I'll work on an e2e test case. Stay tuned. ☺️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Authored by a community member in linear Issue or PR has been created in Linear for internal review ui Enhancement in /editor-ui or /design-system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Saving a workflow with non-existing tag will raise an Error
3 participants