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): Cap NDV Output View Tab Index to prevent rare edge case #11614

Conversation

CharlieKolb
Copy link
Contributor

@CharlieKolb CharlieKolb commented Nov 7, 2024

Summary

currentOutputIndex may end up out of bound as outputIndex is not reactive. Rather than making it a ref which complicates user selection I prefer capping the public currentOutputIndex as this "remembers" the selected branch if it reappears (unless the user selected a new one in the meantime).

After:

Screen.Recording.2024-11-07.at.09.45.14.mov

See ticket for before video.

Related Linear tickets, Github issues, and Community forum posts

https://linear.app/n8n/issue/ADO-2763/bug-ndv-outputview-breaks-when-on-outdated-tab-during-new-test-step

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

@CharlieKolb CharlieKolb marked this pull request as ready for review November 7, 2024 08:52
@n8n-assistant n8n-assistant bot added n8n team Authored by the n8n team ui Enhancement in /editor-ui or /design-system labels Nov 7, 2024
Copy link

codecov bot commented Nov 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@MiloradFilipovic MiloradFilipovic self-requested a review November 7, 2024 10:58
Copy link
Contributor

@MiloradFilipovic MiloradFilipovic left a comment

Choose a reason for hiding this comment

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

Works as expected, kudos for adding a comment there 🙌🏻
Two questions though:

  • Can we add a test for it?
  • Is it easy to update the output panel as number of outputs change so we don't see the generic branch name at all?

Copy link

cypress bot commented Nov 7, 2024

n8n    Run #7780

Run Properties:  status check passed Passed #7780  •  git commit 37bc8dd0f2: 🌳 🖥️ browsers:node18.12.0-chrome107 🤖 CharlieKolb 🗃️ e2e/*
Project n8n
Branch Review ADO-2763/bug-ndv-outputview-breaks-when-on-outdated-tab-during-new-test-step
Run status status check passed Passed #7780
Run duration 04m 24s
Commit git commit 37bc8dd0f2: 🌳 🖥️ browsers:node18.12.0-chrome107 🤖 CharlieKolb 🗃️ e2e/*
Committer Charlie Kolb
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 1
Tests that did not run due to a developer annotating a test with .skip  Pending 2
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 466
View all changes introduced in this branch ↗︎

Copy link
Contributor

github-actions bot commented Nov 7, 2024

✅ All Cypress E2E specs passed

@CharlieKolb
Copy link
Contributor Author

They're great questions, I had the same ones for myself :D

There aren't any existing test for tabulation so it'd quite involved, and considering this PR merely narrows an invalid range to a valid one I'm tempted to forgo adding one here.

I considered updating the shown branches but I don't think we actually want this behavior, as the user might have relevant data in the selected tab.
If the user then messes with node settings that unexpectedly (to them) change the tab count, it would cause data to disappear without the user running the node, which seems less desirable than showing Branch 1 and Branch 2.
Though I did not look into where those new branch names come from and if we can avoid that.

@MiloradFilipovic
Copy link
Contributor

They're great questions, I had the same ones for myself :D

There aren't any existing test for tabulation so it'd quite involved, and considering this PR merely narrows an invalid range to a valid one I'm tempted to forgo adding one here.

I considered updating the shown branches but I don't think we actually want this behavior, as the user might have relevant data in the selected tab. If the user then messes with node settings that unexpectedly (to them) change the tab count, it would cause data to disappear without the user running the node, which seems less desirable than showing Branch 1 and Branch 2. Though I did not look into where those new branch names come from and if we can avoid that.

Makes sense, good to go on my end then

…tputview-breaks-when-on-outdated-tab-during-new-test-step
Copy link
Contributor

github-actions bot commented Nov 7, 2024

✅ All Cypress E2E specs passed

@CharlieKolb CharlieKolb merged commit a6c8ee4 into master Nov 8, 2024
36 checks passed
@CharlieKolb CharlieKolb deleted the ADO-2763/bug-ndv-outputview-breaks-when-on-outdated-tab-during-new-test-step branch November 8, 2024 07:32
@github-actions github-actions bot mentioned this pull request Nov 13, 2024
@janober
Copy link
Member

janober commented Nov 13, 2024

Got released with [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
n8n team Authored by the n8n team Released ui Enhancement in /editor-ui or /design-system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants