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

Data of a Flex Toolbar not cleaned up correctly #6020

Closed
rvaja-infor opened this issue Jan 13, 2022 · 2 comments · Fixed by #6026
Closed

Data of a Flex Toolbar not cleaned up correctly #6020

rvaja-infor opened this issue Jan 13, 2022 · 2 comments · Fixed by #6026
Assignees
Labels
type: bug 🐛 [2] Velocity rating (Fibonacci)

Comments

@rvaja-infor
Copy link
Contributor

rvaja-infor commented Jan 13, 2022

A bug has been identified where the data of the Flex Toolbar has not been correctly cleaned up.

Calls such as $.removeData(this, COMPONENT_NAME$P); do not clean up data correctly, however the following call does correctly work $.removeData(this.element, COMPONENT_NAME$P);. I have seen 8 occurrences in the sohoxi.js file where this is passed.

Describe the bug
A clear and concise description of what the bug is.

To Reproduce

Steps to reproduce the behavior:

  1. Go to 'https://design.infor.com/code/ids-enterprise/latest/demo/components/toolbar-flex/example-more-actions-predefined.html'
  2. Open developer tools in browser, and click the console tab
  3. In the console tab enter $('#flex-toolbar').data('toolbar-flex').destroy()
  4. In the console tab enter $('#flex-toolbar').data('toolbar-flex').

The data is returned but this should have been cleared by the destroy call.

Expected behavior
Data to be cleared correctly, and not be returned back.

Version
4.56.0

Screenshots
N/A

Platform

  • Infor SunSystems
  • Device: Laptop
  • OS Version: Windows 10
  • Browser Name: All Browsers
  • Browser Version: N/A
@rvaja-infor
Copy link
Contributor Author

Note, that some of them it is correct to use 'this', others require 'this.element[0]' or 'this.element' to be passed

@rvaja-infor
Copy link
Contributor Author

As a side, when I made the changes locally I found I could hit a undefined scenario within these functions below. The pasted functions contain the possible checks /resolution to prevent an exception.

function doUnlinkSubmenuItem(actionMenuElement) {
        var $originalMenuElement = $($(actionMenuElement).data('original-menu-element'));
        if ($originalMenuElement) {
	        $originalMenuElement.removeData('action-button-link');
	
	        if ($originalMenuElement.hasClass('submenu')) {
	          var submenuItems = actionMenuElement.querySelector('.popupmenu').children;
	
	          for (var j = 0; j < submenuItems.length; j++) {
	            doUnlinkSubmenuItem(submenuItems[j]);
	          }
	        }
        }

        $(actionMenuElement).removeData('original-menu-element');
      }

      function doUnlinkToolbarItems(i, itemElement) {
        var originalButton = $(itemElement).data('originalButton');
        var originalButtonAPI = $(originalButton).data('toolbarflexitem');
        if (originalButtonAPI) {
	        originalButtonAPI.actionButtonLink = null;
	        $(itemElement).removeData('original-button');
	
	        if (originalButtonAPI.type === 'menubutton') {
	          var submenuItems = itemElement.querySelector('.popupmenu').children;
	
	          for (var j = 0; j < submenuItems.length; j++) {
	            doUnlinkSubmenuItem(submenuItems[j]);
	          }
	        }
        }
      }

@tmcconechy tmcconechy added [2] Velocity rating (Fibonacci) type: bug 🐛 labels Jan 13, 2022
@tmcconechy tmcconechy self-assigned this Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐛 [2] Velocity rating (Fibonacci)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants