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

Improve ERD2W tab switching behaviour #696

Merged
merged 4 commits into from
Nov 29, 2015

Conversation

fbarthez
Copy link
Contributor

The current tab page implementation has some issues, especially when using ajax. When a new ERD2WContainer is instantiated, the navigation will fail, as the default equals() implementation then always returns false. The selected tab is lost when switching from inspect to edit. Changes to the tabSectionsContents (addition or removal of tabs or property keys) will not be honored on switching via ajax from inspect to edit mode.

To remedy these, the tab name is used as the identifier instead of the index of the tab in the tab sections contents. An equals() implementation that compares only the names is added. The caching behaviour is modified to prevent stale tab sections contents from being returned.

…cause stale values to be used. E.g. when switching from inspect to edit causes the displayPropertyKeys to change. For the same reason, reset _currentTab when clearTabSectionsContents is called.
…b. This ensures the current tab will be kept active when a switch from e.g. inspect to edit causes the number of tabs or their order to change. If the current tab is no longer available, fall back to the first tab.

Implement equals() with comparising limited to the name, as the default will only compare memory addresses, resulting in false negatives.
… setTabByName is no longer necessary, as the current tab is being reset with the call to clearTabSectionsContents.
…ill cause a page refresh. This change ensures the current tab will be kept active, as with an ajax update. The tab is identified via its name only, allowing for changes in the displayed property keys and the order of tabs. If the current tab is not available anymore, the first tab is selected.
@darkv darkv added the D2W label Nov 13, 2015
@schleiereule
Copy link

Works for me. Much better behavior, even if the number of tabs changes.

darkv added a commit that referenced this pull request Nov 29, 2015
Improve ERD2W tab switching behaviour
@darkv darkv merged commit 9061166 into wocommunity:master Nov 29, 2015
@fbarthez fbarthez deleted the pr/D2WTabPageCaching branch November 30, 2015 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants