You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the TabMenu component and working with (activeItemChange) i ecnounter the problem that the method i pass is run at least twice. This causes the problem to handle conditional user navigation.
example: A user is currently on page 'profile' and has unsaved data here. When the user clicks on dashboard on the TabMenu, a popup comes up asking if he wants to leave, unsaved data will be deleted. In the background, a copy of the current activeItem profile is made (prevItem) and the new item (dashboard) will be written inside the current active Item. When the user hits 'cancel', he will stay in his component and the active item will be changed back to prevItem.
Unfortunately, due to the method running twice, the previous item will always overwritten, resulting in it always being the new item:
Environment
Angular 17 used in Intellij Ultimate 2024.1.4
Reproducer
No response
Angular version
17.3.8
PrimeNG version
17.13.0
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
v20.12.2
Browser(s)
128.0.6613.114
Steps to reproduce the behavior
insert tabmenu component
create menu items array & active item
insert a few logs an create onChange method
set things in to place
watch the console
Expected behavior
The method should run once so when i save the current activeItem on change, it won't be overwritten when the methods runs a second time
The text was updated successfully, but these errors were encountered:
Normally it output twice time, the first time output the original selected MenuItem, and second time output the newly selected MenuItem. But if the two times you select the same option, it will only output the original selected MenuItem.
P.S. Tested by <p-tabmenu>, not sure will happen on <p-tabView> or not
Describe the bug
When using the TabMenu component and working with (activeItemChange) i ecnounter the problem that the method i pass is run at least twice. This causes the problem to handle conditional user navigation.
example: A user is currently on page 'profile' and has unsaved data here. When the user clicks on dashboard on the TabMenu, a popup comes up asking if he wants to leave, unsaved data will be deleted. In the background, a copy of the current activeItem profile is made (prevItem) and the new item (dashboard) will be written inside the current active Item. When the user hits 'cancel', he will stay in his component and the active item will be changed back to prevItem.
Unfortunately, due to the method running twice, the previous item will always overwritten, resulting in it always being the new item:
Environment
Angular 17 used in Intellij Ultimate 2024.1.4
Reproducer
No response
Angular version
17.3.8
PrimeNG version
17.13.0
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
v20.12.2
Browser(s)
128.0.6613.114
Steps to reproduce the behavior
Expected behavior
The method should run once so when i save the current activeItem on change, it won't be overwritten when the methods runs a second time
The text was updated successfully, but these errors were encountered: