When I open the Perspective Session Event → Page Startup script in Designer, only part of the script is displayed.
However, if I right-click the resource and select Close and Revert, the complete script immediately appears.
The complete script already exists in:
GitHub
Ignition\data\projects
Designer after Close and Revert
Only the initially opened Designer editor shows an incomplete version.
Questions
What exactly does Close and Revert reload?
Does Designer keep a local working copy or cache of Perspective script resources that can become out of sync with the saved project resource?
Is this expected behaviour, or could it indicate a corrupted resource or Designer cache?
Is committing only the page-startup folder (onPageStartup.py and resource.json) sufficient for Git, or are there any other Perspective resource files that should also be version controlled for Session Event scripts?
I'd also like to confirm that my Git workflow is correct. For Perspective Session Event scripts, is committing the corresponding resource folder from data/projects (containing onPageStartup.py and resource.json) all that's required, or is there anything else that should be included?
Close and Revert should be reverting back to whatever was last committed to the Ignition Gateway. This feature exists on systems that aren't using source control.
An example use case...
If you modify a Perspective screen and close it without saving it is still modified for your designer session. You can use close and revert to avoid applying the change to the gateway.
Once you save your changes in Perspective it will update the changes you made and that's the new "latest version".
On another machine (with no local copy of the project), I cloned the latest project from Git and opened it in Designer.
The onPageStartup.py in Git contains the complete script, and the file under data/projects also contains the complete script after the project is loaded.
However, when I open the Page Startup resource in Designer, it again initially shows an incomplete script. If I immediately select Close and Revert, the complete script appears again.
So the Gateway resource, the data/projects file, and the Git repository all contain the complete script, but the Designer editor initially opens an incomplete version until Close and Revert is performed.
Have you tried running a Gateway File System Scan from the Ignition 8.3 Gateway Web Interface? In 8.3, changes made outside of the Designer aren't always picked up automatically, and a file system rescan can force the Gateway to detect and reload those changes. There are separate scan options for projects and the full Gateway configuration, so it's worth giving that a try if you haven't already.
I ran Platform → System → Projects → Scan File System, but it didn't make any difference. The behaviour is still the same.
Also, under Platform → System → Modes, there are no modes configured on this Gateway, so I'm not using the file system scanning workflow for deployment.
Since the complete onPageStartup.py is already present both in the data/projects directory and in the Git repository, I'm trying to understand why the Designer initially displays an incomplete version of the script until I perform Close and Revert.
I also noticed that every time I open the project in Designer, I see the "Migration Required" warning. According to the Ignition 8.3 documentation, this is expected after upgrading a project, and selecting the resource completes the migration for that specific resource, after which the warning disappears.
Since my project was originally migrated to 8.3, I'm wondering whether this migration state could be related to the behaviour I'm seeing with the Page Startup script, or if it's completely unrelated.
Should I be concerned about this warning, or is it safe to ignore once the resource has been migrated? Could it contribute to issues like the Designer initially displaying an incomplete version of a resource?
My hunch is that, because of your use of git, you've left your project(s) in a state that shouldn't normally be achievable - you have both 'modern', post-migration session events and 'legacy' events. In your project on the filesystem, do you have a com.inductiveautomation.perspective/session-scripts/ folder? That's the 'legacy' events. If you remove that, only the 'modern' definition should be used.
The designer holds a snapshot of the project state (updated every time you hit the 'Update Project' button), entirely in memory. There's no disk storage on the local machine where the designer is running.
As of 8.3 and the migration, each session (and gateway, and Vision client) event script type is a dedicated resource type, and therefore a dedicated folder on the filesystem. Each of those should be version controlled separately, but the "legacy" event singletons (the aforementioned session-scripts, along with ignition/event-scripts and com.inductiveautomation.vision/client-event-scripts), which store all event types for a module in a single opaquely serialized data.bin file, should be deleted once the migration has been done.