Repository navigation
Allow tab reload when the 1st load failed - #2325
Open
officialasishkumar wants to merge 1 commit into
Open
officialasishkumar wants to merge 1 commit into
officialasishkumar wants to merge 1 commit into
Conversation
Fomantic-UI calls the "onFirstLoad" tab callback only once, even when the request it started failed. A tab whose 1st load failed, for example because of a server exception or a network error, stayed blank until the whole page was reloaded. Use the "onLoad" callback, which is called each time a tab is activated, and track the loaded state using jQuery data of the tab subview, as the virtual page element is replaced by the loaded content. The state is set before the request is sent, so activating the tab during a pending load does not send a 2nd request, and it is removed when the request did not succeed. Successfully loaded tabs remain cached, no additional request is sent when they are activated again.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix #2256
Fomantic-UI calls the
onFirstLoadtab callback only once, even when the request it started failed, so a tab whose 1st load failed stayed blank until the whole page was reloaded.As suggested in the issue, the tab now uses
onLoad, which is called on each activation, and tracks the loaded state itself:onCompletewhen the request did not succeed.onSuccessandonFailureare not used because they would replace the global handlers fromapiService.Tabs with
cache => falseare unchanged and successfully loaded tabs remain cached.Added a
tab.featurescenario, which fails without the fix. I also checked these flows in Chromium using a temporary page with server-side request counters: a load that fails once and then succeeds, a cached tab that sends only one request, and activating a tab during a pending load.Behaviour note for cached tabs with a callback:
onLoadpassed in$settingsandapiSettings.onCompleteare now overwritten by this logic.onLoadwas already overwritten forcache => falsetabs, and nothing in the repository passes either of them.