Redundant calls to @handler

HI,

I’m writing a channel and I noticed the the handler method is called multiple times while traversing the directory tree of the channel.
I checked with chrome network monitoring via the plex web ui and indeed there are calls to the prefix url clicking on DirectoryObjects and VideoClipObjects in addition to the actual calls.
From what I read in the documentation that is not the expected behavior.

This is essentially my code

@handler(PREFIX, TITLE)
def MainMenu():
    Log.Debug('MainMenu')
    oc = ObjectContainer()
    oc.add(DirectoryObject(
         key=Callback(Category, id='1'),
         title='abc'
     ))


@route(PREFIX + '/category/{id}')
def Category(id):
    oc = ObjectContainer(title1=L('name'))
    oc.add(DirectoryObject(
          key=Callback(Category, id='2'),
          title='dfg'
    ))
    return oc

Looking in the plugin logs I can see the MainMenu entry after clicking the DirectoryObject ‘abc’ and even after clicking on the DirectoryObject ‘dfg’.

Am I missing something? should the handler be called for every link in the page?

thanks

BTW, I checked, it happens on other plugins too.
I find it strange that when I click on a DirectoryObject a Callback method (routed!) is invoked in addition to the handler - the handler should not have been involved but rather only the routed method I called with the Callback.

This behavior SLOWs down plugins - most plugins I’ve seen use the handler to initialize and download data from the web, if for every object clicked in the ui we redo this - it harms the UX.

I think we’re experiencing similar problems: http://forums.plex.tv/discussion/216372/why-is-the-main-route-always-called-twice