Closed ChrisRomp closed 6 years ago
Hello @ChrisRomp !
SPGo should automatically refresh the in-memory config object any time a change made to the SPGo.json. The only thing that would cause the config file to not refresh would be a file schema error, or possibly some issue where SPGo is not correctly parsing the new config data.
Repro Steps
ctrl+s
or using the publishing controls)SPGo.json
, enter the URL of a different SharePoint site.SPGo.json
file - ensure there are no errors in the output log.SPGO.json
Also, if you are still seeing the issue after following the steps above, can you look in the output window for all items scoped to SPGo and send any errors you see? Can you share your config file (feel free to mask customer data)?
@sg-chrishasz,
I'm using the default schema except I've added a remoteFolders
section.
I have two site collections, let's call them "QA" and "Prod." In QA the SPGo.json file has sharePointSiteUrl
set to https://tenant.sharepoint.com/sites/qa
and in prod it's .../prod
.
I will have (for example) a config.js
file on the SharePoint server that has something specific to its environment, let's say a URL. If I open VSCode with the QA branch checked out, and then compare the file to the server, it is correct.
Then if in git I check-out the prod branch, the sharePointSiteUrl
changes to .../prod
. If I run a "compare with server" the system queries the QA server for config.js
and highlights the differences between them. I can open SPGo.json, make an arbitrary change like hitting space then backspace, save it, and then it seems to pick up the change and my comparison will check the config.js
file in prod.
So it seems that for whatever reason SPGo isn't "noticing" the change in SPGo.json when it happens via git (even though VSCode does show the update in the code editor).
From the console, no errors are reported that appear related to this (there are some other misc. messages related to not finding config.js.git
when I open config.js
, for example). When I git checkout the prod branch, nothing appears in the SPGo console, however then when I hit space/backspace and hit save, Configuration file reloaded
is printed, seeming to verify my hypothesis that SPGo isn't reloading on git checkout.
Thanks!
Thanks for the thorough repro steps. SPGo currently reloads the config file only if it is edited inside VSCode. Any external program (e.g. git) that makes changes directly to the file will not be reflected immediately immediately inside of VSCode.
I will need to rebuild the configuration object to support live reloads, but I can make this change. That said, I like caching the object internally as an optimization, so I may add that as a configurable parameter later if people begin experiencing performance issues.
Maybe better is to have a command that will reload the config. Is there already one?
I like that option better. I do not have a command yet, but it is easy to add (and has a much smaller blast-radius than a rewrite of the config file). Here is what I'm thinking:
command: SPGO> Reload Configuration
shortcut: <alt>+r, <alt>+c
Sounds great!
Done - SPGO 1.2.4 has been published to VS Marketplace.
I appreciate the feedback and support!
My team uses different branches for different environments. It's nice that we can have different SP site URLs in SPGo.json, but when we switch environments SPGo is still caching the previous URL. If it could check the
sharePointSiteUrl
parameter before an operation (ok to assume the security model/context is the same, IMO), that would enable us to switch environments without having to reload VS Code.