Hmm, I didn’t immediately run into the same error when trying it out. With that said, the code you linked to is quite old these days! I think this should cover most of the modern patterns and achieve the same (or better) result. Can you give it a try, of course with values that make sense for your community?
<script type="text/discourse-plugin" version="0.10.0">
const I18n = require("I18n").default;
I18n.translations[I18n.locale].js.filters.topliked = { help: "Top Liked" };
api.addNavigationBarItem({
displayName: "Top Liked",
name: "topliked",
before: "top",
href: "?order=op_likes&status=open",
customFilter: category => {
return category && category.name === "Testing"
},
forceActive: (category, args, router) => {
const queryParams = router.currentRoute.queryParams;
return (
queryParams &&
Object.keys(queryParams).length === 2 &&
queryParams["order"] === "op_likes" &&
queryParams["status"] === "open"
);
}
});
</script>