Moodle for mobile

core-context-menu-item not being picked up on first load

 
Picture of Mark Johnson
core-context-menu-item not being picked up on first load
Core developersParticularly helpful MoodlersPlugin developers

In the template for our course format, we have some markup like this:

    <core-navbar-buttons>
        <core-context-menu>
            <core-context-menu-item [priority]="900" content="Link" iconAction="open" autoLogin="no" [href]="http://example.com">
            </core-context-menu-item>
        </core-context-menu>
    </core-navbar-buttons>

This should display the link in the course page's context (three dots) menu.  However the behaviour we're seeing is that the first time you enter the course, it is not displayed.  If you pull to refresh, then it is displayed and will be displayed from there on.  It doesn't appear to happen on other pages, such as our course module plugins which add menu items in the same way.

It's not very easy for me to recreate this as a minimal test case, so I was wondering if anyone else had seem similar behaviour?

 
Average of ratings: -
Picture of Mark Johnson
Re: core-context-menu-item not being picked up on first load
Core developersParticularly helpful MoodlersPlugin developers

From what I can tell by debugging, it seems that my core-navbar-buttons component is not being processed at all.  I have put a breakpoint on line 79 of /src/components/navbar-buttons/navbar-buttons.ts (inside ngOnInit), and the first time I load the page, the function is not run with my element.  After the pull-to-refresh, it is run with my element.

 
Average of ratings: -
Picture of Mark Johnson
Re: core-context-menu-item not being picked up on first load
Core developersParticularly helpful MoodlersPlugin developers
I've managed to recreate this using a copy of the topics format plugin, I've raised it on the tracker: https://tracker.moodle.org/browse/MOBILE-2745
 
Average of ratings: -
Picture of Isabel Renedo
Re: core-context-menu-item not being picked up on first load
 

Mark, thanks for opening an issue on the tracker!

 
Average of ratings: -