Editing code injection and navigation at the same time does not work

Issue Summary

I was trying to set up some sitewide code injection to change the nav bar. So I had the navigation page and the code injection page open in different windows. And I had another tab open with the site itself, which I was hard-reloading to see changes.

I repeatedly observed that saving in one window caused the other window’s values to ‘warp’ back to previous settings. (The window with the settings didn’t change until I reloaded it, but the values were clearly changing based on the site itself.)

Steps to Reproduce

  1. Open tabs for code injection AND navigation. Make changes that’ll be obvious on the site. Save both.
  2. Make another change and hit save again, then reload the site. The values from the first edit will be there.

Setup information

Ghost Version
Setup: I downloaded the very latest (5.16.0) version. It was also present in 5.10.1. I’ve only tested on development, on Windows, with sqlite3 as the database.

Node.js Version
16.15.1

How did you install Ghost?
Using the development package for windows, followed by multiple updates.

Provide details of your host & operating system
Windows, in development mode.

Database type
SQLite 3

Browser & OS version
Chrome

Relevant log / error output
none

Have noticed this for a few years now, as well as a few minutes ago. I presumed this was par for course, but now that you mention it, well, if people can co-edit documents or what have you (on other platforms) I suppose editing code injection as well as navigation in different tabs at the same time should also be possible without nullifying the other?

Either way, this is not a new issue.

Can you add whether this is present with production settings also (including MySQL), to help the Ghost team decide how serious the issue is? I haven’t had a chance yet.

It’s currently the “expected” behaviour and has always been the case. It’s a bit like opening a form on a website in two tabs, filling in the details in on one tab and saving, then switching to the other tab and filling in with other details and saving - on the first tab you’ll still see the old data and if you save it again you’d expect that data to save.

Thanks for the reply, Kevin. I’m not sure if you’ve understood what I’m describing, so I’m going to try again.

To clarify: I’m editing the code injection in one tab and the navigational items in another tab. Saving the navigational items causes the saved values for code injection to revert to whatever they were when I opened the navigational items tab, and vice versa. I would absolutely expect that behavior if I’d opened two copies of the same settings page, but this ‘feels’ from a UI standpoint like two totally different pages, given that none of the data for code injection is visible on the navigation page or vice versa. It may be how it’s been forever, but I think it’s not expected behavior for anyone who hasn’t previously experienced this issue and gotten used to it.

Does that make sense? I can provide a video demonstration if it helps.

I understood, no need to explain again. It’s the same thing as I tried to explain though - each instance of the app that’s you’ve opened has it’s version of the settings loaded, editing the settings in one instance of the app won’t instantly update it in the other, so if you’re editing in both you can keep resetting values to the old ones.

Navigation and code injection are both part of the same “settings” document. Unless you navigate to a different settings screen to trigger a re-fetch of those settings in the first instance after making a change in the second instance then the two instances of the app are out of sync and you’re in danger of overwriting with out-of-date settings.

1 Like

I’ve opened an issue here along with details of a potential fix https://github.com/TryGhost/Ghost/issues/15470

If anyone in the community has time to pick that up and take a look we’d be very grateful :pray:

Thanks, Kevin. I haven’t played with Ember before, but I’ll take a look. Based on my other work, it’s not going to be this week or next, so if someone else wants to swoop in and grab it, please don’t wait for me! :) (I’m not claiming it on GitHub.)