modifyClass gives TypeError undefined?

I’m creating a theme component. I have this in the header:

<script type="text/discourse-plugin" version="0.8">

    api.modifyClass("model:post-stream",  { 
        pluginId: 'test',
        appendMore: function() {
            this._super();
            console.log("append");
        }
    });

</script>

I want to override appendMore and which add posts to the post stream as you scroll. It seems it are being properly overridden as the console is logging as expected. There are two issues though:

  1. this error is showing up in the console and I don’t want it to :upside_down_face:

Uncaught TypeError: postStream.appendMore() is undefined

  1. I am not altering the functionality yet but adding this line of code significantly slows posts being loaded in. Where is this extra time overhead is coming from?

Thanks in advance!

1 Like