In case anyone is interested, here is my reengineered code THAT WORKS.
/public/pageNavigation.js
import {session} from 'wix-storage';
import wixLocation from 'wix-location';
export function currentPage() {
session.setItem("page", wixLocation.url);
}
export function previousPage() {
return session.getItem("page");
}
In the page navigating FROM
import {currentPage} from 'public/pageNavigation.js';
import {previousPage} from 'public/pageNavigation.js';
import {session} from 'wix-storage';
$w.onReady(function () {
// NOTE: if navigating from Members Only page to SVCGR File Share page, then currentPage MUST
// be set in the Members Only page
// Set this page URL in the public/pageNavigation.js shared module
currentPage();
In the page navigated TO
import {currentPage} from 'public/pageNavigation.js';
import {previousPage} from 'public/pageNavigation.js';
$w.onReady(function () {
// NOTE: if navigating from Members Only page to SVCGR File Share page, then currentPage MUST
// be set in the Members Only page
let prevPage = previousPage();