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

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

by Mark Johnson -
Number of replies: 3
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin 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: -
In reply to Mark Johnson

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

by Mark Johnson -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin 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.

In reply to Mark Johnson

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

by Mark Johnson -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin 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
In reply to Mark Johnson

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

by Isabel Renedo -
Picture of Moodle HQ Picture of Particularly helpful Moodlers

Mark, thanks for opening an issue on the tracker!