[00:44:05] Dreamy_Jazz: ack, I;m not familiar with GT, but I might be able to figure this out. [00:44:38] I'm using https://doc.wikimedia.org/GuidedTour/master/js/#!/api/StepBuilder and the linked clsses and source links for easy navigation around this code, fwiw [00:44:47] back = function ( backValue ) { [00:44:47] return this.setDirectionCallback( 'back', backValue ); [00:44:47] }; [00:45:44] Thanks for having a look [00:46:31] Dreamy_Jazz: so, it says here that if a direction is already set, an error is thrown [00:46:40] it sounds like you're not getting that though, is that right? [00:46:45] Yup. [00:47:01] e.g. calling back() a second time from that getRights async code, does not throw an error to the console? [00:47:12] Yup [00:47:28] I tested by adding a console.log the line before, so I know that it runs [00:47:40] And I'm pretty sure in a previous iteration of this I had it so that it never set the next or back twice [00:47:51] But I've lost those changes [00:48:27] ok, I'll try to reproduce that, but meanwhile - what if you don't set it twice, e.g. leave off the initial back() and next() calls for steps that you'r enot sure of, and then in the getRights() callback, add an `else` branch with the defaults you have now [00:48:49] Yup. Thanks. [00:52:02] Dreamy_Jazz: when I debug your pasted version, it does throw an error for me when calling back(), and next() is not reached. [00:52:37] Strange. I'm using Firefox and a console.log directly after the two statements outputted [00:53:51] I've updated the code as you suggested in https://paste.toolforge.org/view/7fa0d84f [00:54:19] And when running the Firefox console shows this: [00:54:23] https://usercontent.irccloud-cdn.com/file/RbG52GJw/image.png [00:54:43] however, as being called from a Promise (mw.user.getRights), these are hidden from the console. [00:55:06] Ah. I would have thought that the error would have stopped the console.log? [00:55:42] Your last paste has no duplicate errors and a console error within the conditional after the two statements [00:56:01] I imagine if you added back now (also) an earlier back() or next() call that that would throw indeed and thus (again) not reach the console log [00:56:11] Ah. I see. Let me try. [00:56:22] if you had the console log at the start, that would have been logged however :) [00:56:48] I ran a modified version of your code in a private window on testwiki Special:Blankpage (I commented out the first two early returns about Investigate) [00:57:05] https://usercontent.irccloud-cdn.com/file/wabsUJRf/capture.png [00:57:12] thsi is from your first paste [00:57:33] I added `debugger;` before the `if` conditino in the getRights callback [01:00:00] Yup. I see that my first paste didn't run and failed. Would have helped to see the error message. Still unable to get the expected behaviour though. [01:01:30] As using an account that has the block right it doesn't have the block step in the guided tour. [01:04:06] Dreamy_Jazz: the second version with the if/else should be fine, assuming the inital definition omits the back/next() call that you're setting later from getRights. [01:04:54] If with this version it has no back/next at all, then I guess it might be getting started too soon and then cached or something. [01:06:41] I presume it is. Perhaps the tour builder finishes once the JS function that everything is wrapped in returns and so the changes affect the steps but not the tour that is now constructed. [01:06:53] In that case, you might have to defer the entire definition, e.g. move it all in a function, and call that from the callback. So instead of `x = new tour; .... ... getRights( => x.back )`, instead `function init( hasBlockRight ) { x = new tour; ... } ... mw.user.getRights().then( => init( rights.indexOf('block') !== -1 ) );` [01:07:48] I'll try that. Thanks. [01:14:16] Nope didn't work unfortunately ( https://paste.toolforge.org/view/9a2bfe3e is the code). It prints out all the console.log()s so it's not failing due to an error. It causes the tour to not even show. [01:15:24] I'm going to head off for the night. Thanks for your help. I'll add this final code link to the Phabricator ticket [01:19:36] If you do have a further look and see anything that might fix this the relevant phab ticket is https://phabricator.wikimedia.org/T268152 [13:02:10] [[Tech]]; Ilovemydoodle; /* Idea: Tipping (From Wikiquote) */ new section; https://meta.wikimedia.org/w/index.php?diff=23364735&oldid=23356680&rcid=24175671