[Misc] Updated the method to call init() using newer XWiki API#2
Open
wthrajat wants to merge 1 commit intoxwiki-contrib:masterfrom
Open
[Misc] Updated the method to call init() using newer XWiki API#2wthrajat wants to merge 1 commit intoxwiki-contrib:masterfrom
wthrajat wants to merge 1 commit intoxwiki-contrib:masterfrom
Conversation
9inpachi
requested changes
Sep 6, 2023
Member
9inpachi
left a comment
There was a problem hiding this comment.
Thanks for the contribution. I have one minor comment.
| leafletCommons.updateURLWithMapState(); | ||
| }); | ||
|
|
||
| $(init).on('xwiki:dom:updated', init); |
Member
There was a problem hiding this comment.
This statement is inside the init function. It won't work because the init function will never be called and even if it's called like this, it will result in an infinite recursion.
You can move this statement outside the scope of the init function and it should work just fine.
Member
There was a problem hiding this comment.
@9inpachi is right. This line needs to be moved below, outside the init function.
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.
This PR doesn't change anything except for using a shorter method to first check for DOM loaded and then for DOM updated.
Idea credits: @mflorea
This calls init:
$(init).on('xwiki:dom:updated', init);Similar usecase: https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-tree/xwiki-platform-tree-war/src/main/webapp/resources/uicomponents/widgets/tree.js#L32
See: https://api.jquery.com/jquery/#jQuery3