Theme component upgrade via rake not working

We have a theme component that we install via the rake command. The plugin and its installation via the rake command works perfectly fine. The upgrade also works perfectly fine when we do it from the Admin UI e.g. /admin/customize/themes/40. The problem arises when we try to upgrade it from the command line with that rake command. The output is exactly as I would expect. However, the changes don’t reflect. Does this look like a bug?

$ rake themes:install -- '--{"discourse-login-modal": {"url": "https://github.com/example/discourse-login-modal.git", "add_to_all_themes": true}}'
discourse-login-modal: is already installed. Updating from remote.

Results:
 Installed: 0
 Updated:   1
 Errors:    0
1 Like

Providing more details of the issue. Running the rake command for upgrade doesn’t have any visible change to my theme component, but after that the Admin UI thinks that the upgrade has been applied (missed capturing the screenshot).

After a subsequent change in my theme component, the Admin UI is now showing that an upgrade is available, but when applying it I get this warning that my local changes will be overwritten. These changes are exactly what I wanted to apply via the rake install command which didn’t actually apply.


.

1 Like

Hi @markvanlan, thank you for the your work on the rake command to install a theme! Would you know why the upgrade via rake install is not working.

1 Like

I will look into this a bit later into this week. I wasn’t aware that the rake command was not working

1 Like

I couldn’t figure out why the update doesn’t work, but thought of a workaround–adding an uninstall command. Uninstalling the theme before using the rake install command seems to be working.

I raised a short PR to check if this approach is ok to pursue: [WIP] FEATURE: Rake task to uninstall theme by chandandi · Pull Request #10138 · discourse/discourse · GitHub

I apologize for forgetting to circle back on this!

I have an idea of why this may not be updating. If I am correct, this should be a very quick fix.

Something is very weird here. When ThemesInstallTask updates a remote theme, the remote info is updated correctly (latest sha is shown, and commits_behind is 0 as you noted)

But the scss is not updated in the database. I was assuming it was a cache not busting, but that is not the case! The scss in the database is not updating.


The value should be different in this screenshot

Looking at how the admin theme controller handles updates compared to how the task updates remote themes, I do no see what is different.

:male_detective: :mag:

I will get to the bottom of this mystery.

I got to the bottom of the problem and created a PR. I explain the issue in the description.

Merged! Update is fixed.

3 Likes