Text file via shared link does not show latest version

Nextcloud version (eg, 20.0.5): 24.0.7
Operating system and version (eg, Ubuntu 20.04): Debian 11.5
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.54
PHP version (eg, 7.4): 7.4.33

The issue you are facing:
When sharing a text file via the “Share Link” method, going to that link displays what is evidently a copy of the text file, not the original. Updates to the original text file do not show up in the copy displayed by the Shared Link, and can take anywhere from minutes to days to finally appear (with no apparent rhyme or reason for the delay). It does not appear to be controlled by cron.php - I can run that manually and file changes still will not be shown via Shared Link (only via download).

I have discovered as part of trying to figure out why this happens that said text files seem to get intermittently copied to NEXTCLOUD_DATA_DIR/appdata_SITEID/text/documents/[id of file], and it is these rather than the original files that are displayed via Shared Link. I do not know what triggers this copy, how to force a new copy, how to bypass this copying procedure and just serve the file directly, why not all text files shared by Shared Link appear here, and why the amount of time for this copy to be updated is variable.

Questions:

  1. Is this intended behavior?
  2. If so, why?
  3. How can I tweak things such that changes are available to Shared Link views of a text file as soon as the revised original is uploaded to Nextcloud? (I’m looking for immediate availability here, comparable to Simplenote’s “publish a note” feature.)

Any information appreciated; thanks!