Upcoming topic-list changes - how to prepare themes and plugins

Sorry to eat into your weekend David, yes, just saw the API, thanks

3 Likes

Hi, I’ve tried to use value transformer for “topic-list-columns” like this:

export default {
    name: "assignment-topic-list-column-modifier",

    initialize(container) {
        const router = container.lookup("service:router");

        withPluginApi("1.39.0", (api) => {
            api.registerValueTransformer(
                "topic-list-columns",
                ({ value: columns }) => {
                    if (ASSIGN_LIST_ROUTES.includes(router.currentRouteName)) {
                        columns.add("posters-recent", {
                            header: AssignHeaderCell,
                            item: AssignCell,
                            after: "posters",
                        });
                    }
                    return columns;
                }
            );
        });
    },
};

The goal is to insert new column item and header after “posters” column, it works for the item, but the header still not in the right place, it was placed after “activity” column.

Is there something missing in my code? and is there any documentation that explain how to do this correctly?

There is a new guide:

However, it may not be very useful in this case.

@NateDhaliwal thanks for the info, i will check it.

I think the code should look like:

columns.add(
  "posters-recent", 
  { header: AssignHeaderCell, item: AssignCell }
  { after: "posters"}
});

And you might need to specify a before:

{after: "posters", before: "replies"}
1 Like

@Arkshine thanks a lot, your code works !!! awesome :+1:

1 Like

We’ve now enabled the warning banner for these deprecations, so community admins will be notified about any themes or plugins which still need to be updated.

We’ve also published a reference guide with signposts to all the different ways you can customize the new topic list:

I’ve added a link to that from the OP.

6 Likes

David, not sure if you prefer this Topic or the other, but here goes:

My new compliant (I think) component is failing when Enable Glimmer Topic List is set to Auto …

It suggests the new API is not being activated on Auto … is there something I need to do to sign-post the Theme Component so Discourse uses the new Glimmer API when on Auto?

3 Likes

I’ve noticed the warning here:

But it’s still not messing anything up despite the date you provided above has passed and I’m on the latest build…?

Things are delayed a little bit, but we hope to finish dropping the old code in the next 1-2 weeks

So would that completely break themes who aren’t up to date yet? Should we avoid updating? or is there anything we can do simply if we fork the theme?

1 Like

It will prevent their customizations to the topic-list from being applied, yes.

I wouldn’t recommend that. Discourse core updates often include security fixes, and your community may be vulnerable if you stop updating.

Sounds like you got it figured out in the other topic :chefs_kiss:

1 Like