Message Bus fail when changing "Skip new user onboarding tips and badges" user setting

To repro

  1. visit meta.discourse.org/my/preferences/interface

  2. Open your browser console

  3. toggle Skip new user onboarding tips and badges and click save

See the error in the console:

MESSAGE BUS FAIL: callback /user-tips/2770 caused exception onMessage/<@https://d11a6trkgmumsb.cloudfront.net/assets/discourse-aca223ea4cd01ddb1a6f180395955d62c82cdfd63a0f788938e09aae5af55f55.br.js:4216:653
onMessage@https://d11a6trkgmumsb.cloudfront.net/assets/discourse-aca223ea4cd01ddb1a6f180395955d62c82cdfd63a0f788938e09aae5af55f55.br.js:4216:597
U.prototype._run@https://d11a6trkgmumsb.cloudfront.net/assets/vendor-33e08796a908852ea6a675c57d6711f18f2428795ec0f2548e4df9733e003014.br.js:4446:94
U.prototype._join@https://d11a6trkgmumsb.cloudfront.net/assets/vendor-33e08796a908852ea6a675c57d6711f18f2428795ec0f2548e4df9733e003014.br.js:4445:256
U.prototype.join@https://d11a6trkgmumsb.cloudfront.net/assets/vendor-33e08796a908852ea6a675c57d6711f18f2428795ec0f2548e4df9733e003014.br.js:4408:13
p@https://d11a6trkgmumsb.cloudfront.net/assets/vendor-33e08796a908852ea6a675c57d6711f18f2428795ec0f2548e4df9733e003014.br.js:2570:63
m/<@https://d11a6trkgmumsb.cloudfront.net/assets/vendor-33e08796a908852ea6a675c57d6711f18f2428795ec0f2548e4df9733e003014.br.js:2573:8
b@https://d11a6trkgmumsb.cloudfront.net/assets/chunk.703.1bbc722b2533c9d7510a-e77869e990640cdc164a270bdea9a4b9995366c02a371c298741dcb9d72003ca.br.js:833:7
w@https://d11a6trkgmumsb.cloudfront.net/assets/chunk.703.1bbc722b2533c9d7510a-e77869e990640cdc164a270bdea9a4b9995366c02a371c298741dcb9d72003ca.br.js:833:274
P@https://d11a6trkgmumsb.cloudfront.net/assets/chunk.703.1bbc722b2533c9d7510a-e77869e990640cdc164a270bdea9a4b9995366c02a371c298741dcb9d72003ca.br.js:846:6
r</k/onProgressListener/t.onprogress@https://d11a6trkgmumsb.cloudfront.net/assets/chunk.703.1bbc722b2533c9d7510a-e77869e990640cdc164a270bdea9a4b9995366c02a371c298741dcb9d72003ca.br.js:849:163
EventHandlerNonNull*onProgressListener@https://d11a6trkgmumsb.cloudfront.net/assets/chunk.703.1bbc722b2533c9d7510a-e77869e990640cdc164a270bdea9a4b9995366c02a371c298741dcb9d72003ca.br.js:849:44
xhr@https://d11a6trkgmumsb.cloudfront.net/assets/chunk.703.1bbc722b2533c9d7510a-e77869e990640cdc164a270bdea9a4b9995366c02a371c298741dcb9d72003ca.br.js:850:27
send@https://d11a6trkgmumsb.cloudfront.net/assets/vendor-33e08796a908852ea6a675c57d6711f18f2428795ec0f2548e4df9733e003014.br.js:468:67
ajax@https://d11a6trkgmumsb.cloudfront.net/assets/vendor-33e08796a908852ea6a675c57d6711f18f2428795ec0f2548e4df9733e003014.br.js:448:12
l@https://d11a6trkgmumsb.cloudfront.net/assets/discourse-aca223ea4cd01ddb1a6f180395955d62c82cdfd63a0f788938e09aae5af55f55.br.js:4065:10
initialize/n.ajax@https://d11a6trkgmumsb.cloudfront.net/assets/discourse-aca223ea4cd01ddb1a6f180395955d62c82cdfd63a0f788938e09aae5af55f55.br.js:4069:531
k@https://d11a6trkgmumsb.cloudfront.net/assets/chunk.703.1bbc722b2533c9d7510a-e77869e990640cdc164a270bdea9a4b9995366c02a371c298741dcb9d72003ca.br.js:848:66
n@https://d11a6trkgmumsb.cloudfront.net/assets/chunk.703.1bbc722b2533c9d7510a-e77869e990640cdc164a270bdea9a4b9995366c02a371c298741dcb9d72003ca.br.js:857:25
r</start/e.onVisibilityChange@https://d11a6trkgmumsb.cloudfront.net/assets/chunk.703.1bbc722b2533c9d7510a-e77869e990640cdc164a270bdea9a4b9995366c02a371c298741dcb9d72003ca.br.js:858:166
callback@https://d11a6trkgmumsb.cloudfront.net/assets/discourse-aca223ea4cd01ddb1a6f180395955d62c82cdfd63a0f788938e09aae5af55f55.br.js:4067:192
d@https://d11a6trkgmumsb.cloudfront.net/assets/discourse-aca223ea4cd01ddb1a6f180395955d62c82cdfd63a0f788938e09aae5af55f55.br.js:5743:26
p@https://d11a6trkgmumsb.cloudfront.net/assets/discourse-aca223ea4cd01ddb1a6f180395955d62c82cdfd63a0f788938e09aae5af55f55.br.js:5743:92
m@https://d11a6trkgmumsb.cloudfront.net/assets/discourse-aca223ea4cd01ddb1a6f180395955d62c82cdfd63a0f788938e09aae5af55f55.br.js:5743:129

The toggle seems to work fine despite the error, so not sure if it’s an actual issue.

6 Likes

It might be a good idea to check this.site.user_tips before. :smile:

  if (this.site.user_tips) {
    (seenUserTips || []).forEach((userTipId) => {
      this.currentUser.hideUserTipForever(
        Object.keys(this.site.user_tips).find(
          (id) => this.site.user_tips[id] === userTipId
        )
      );
    });
  }

I believe MessageBus is sent after saving is done; that’s why it works. It does not harm and should not be an actual issue.

3 Likes

Technically, that should be always set. It is unset only when a user visits the page and admins enable user tips afterward. For this reason, I believe a better solution is to set refresh: true for that site setting. Anyway, I think your solution adds some more protection and fills in the gap between the time the site setting is changed and the page is refreshed.

Thank you for your interest! Here is the fix:

3 Likes