n8n/packages
Ricardo Espinoza 8a3c87f69c
fix(editor): Items count display in running workflow (#8148)
## Summary
> Describe what the PR does and how to test. Photos and videos are
recommended.

Every time the `MainHeader` component is created, we register a new
handler for the "push" messages. Unfortunately this becomes an issue if
you go multiple times to a page that renders the `MainHeader`, e.g
`/workflow/:id`, without refreshing the page; because all handlers will
be called, causing behavior duplication.

I added the possibility of passing an ID, and made impossible to have
multiple handlers with the same ID However, it does not seems to be
needed to support an array of handlers in the pushConnection store. If
that is the case:

1. We might want to have only one handler for the push connections at
all times, which would be a much simpler approach.
2. Register the handler on app.mount instead.

The issue seems to have been introduced
[here](https://github.com/n8n-io/n8n/pull/7763/files#diff-f5dae80a64b9951bb6691f1b9d439423cf84fa0cc9601b3f2c00904f3135e8deR48)

Before the change:

https://www.loom.com/share/85cf8ef896254d848a13a6c6438daa47

With the change:

https://www.loom.com/share/f5c4ffac421d46cc8e389364e1c357d3

## Related tickets and issues

https://linear.app/n8n/issue/ADO-1596/bug-items-count-display-in-running-workflow


## Review / Merge checklist
- [x] PR title and summary are descriptive. **Remember, the title
automatically goes into the changelog. Use `(no-changelog)` otherwise.**
([conventions](https://github.com/n8n-io/n8n/blob/master/.github/pull_request_title_conventions.md))
- [ ] [Docs updated](https://github.com/n8n-io/n8n-docs) 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.
2024-01-03 11:31:33 -05:00
..
@n8n 🚀 Release 1.23.0 (#8205) 2024-01-03 13:41:28 +01:00
@n8n_io/eslint-config ci: Disable import/no-extraneous-dependencies in frontend tests (no-changelog) (#8182) 2023-12-29 10:45:55 +01:00
cli feat(core): Cache test webhook registrations (#8176) 2024-01-03 16:58:33 +01:00
core 🚀 Release 1.23.0 (#8205) 2024-01-03 13:41:28 +01:00
design-system 🚀 Release 1.23.0 (#8205) 2024-01-03 13:41:28 +01:00
editor-ui fix(editor): Items count display in running workflow (#8148) 2024-01-03 11:31:33 -05:00
node-dev 🚀 Release 1.23.0 (#8205) 2024-01-03 13:41:28 +01:00
nodes-base 🚀 Release 1.23.0 (#8205) 2024-01-03 13:41:28 +01:00
workflow 🚀 Release 1.23.0 (#8205) 2024-01-03 13:41:28 +01:00