On history back (back button I browser) an old page can be used (included 
outdated cookies).

I am using Tapestry templates if it fills my needs. The code gets more robust 
that way. On more complicated UX parts when state changes and fields need to be 
updated React is very nice. When Tapestry Zones gets to complicated I switch to 
React, or mix them.

The communication with Tapestry is done using ajax or forms. A snippet using 
Tapestry form:

       let $hiddenAirTemp = $("[data-id='hiddenAirTemp']");
        let $waxDataForm = $(waxDataFormSelector);
        WaxEndUser.stopCallback = (y: number) => {
            $hiddenAirTemp.val(WaxEndUser.airTemp);
            $waxDataForm.submit();
        };

I use Tapestry Ajax to get good error messages:

       writeCookies() {
            let options: MapUserSettings = {
                focusSkateTrail: this.focusSkateTrail
            };
            TapestryUtil.ajax("/index" + ":writeMapUserSettingsCookies", {data: 
options});
        };

tapestryutil.ts:
...
/*
     * @public
     * @param {string} url
     * @param {Object=} options
     * @param {{}|String|Array} [options.data]
     * @param {String} [options.method=POST]
     * @param {TapestryUtil.ResponseFunction} [options.success]
     * @param {TapestryUtil.ResponseFunction} [options.failure]
     * @param {Function} [options.complete]
     * @returns TapestryUtil.RequestWrapper
     */
    static ajax(url: string, options?: AjaxOptions): RequestWrapper {
        let newOptions = {...options};
        return Ajax(url, newOptions);
    };


I think TypeScript is a "must" to get good client code. I use also JSX. I am 
looking for a way to use the same interface for Tapstery/Java services and 
Typescript for data access. Maybe Kotlin can be used.

S-E


-----Original Message-----
From: JumpStart <geoff.callender.jumpst...@gmail.com> 
Sent: lørdag 23. februar 2019 03:01
To: Tapestry users <users@tapestry.apache.org>
Subject: Re: Browser History API

Very interesting. A couple of questions:

What issues is that header addressing?

What role is Tapestry playing in your spa? How is React communicating with 
Tapestry?

> On 22 Feb 2019, at 3:26 pm, Svein-Erik Løken <se.lo...@brav.com> wrote:
> 
> For single page web apps I recommend setting:
> 
> response.setHeader("Cache-Control", "no-cache, max-age=0, must-revalidate, 
> no-store");
> 
> I am using Tapestry + React + Typescript for my single page application - 
> works very well 😊
> 
> -----Original Message-----
> From: JumpStart <geoff.callender.jumpst...@gmail.com> 
> Sent: fredag 22. februar 2019 02:16
> To: Tapestry users <users@tapestry.apache.org>
> Subject: Re: Browser History API
> 
> Thank you, but I think I’ll mostly want the server-side making the decision 
> on what to make navigable. We shall see how that pans out.
> 
>> On 21 Feb 2019, at 3:29 pm, Svein-Erik Løken <se.lo...@brav.com> wrote:
>> 
>> You can manipulate the URL from Javascript/Typescript:
>> 
>> (history as History).replaceState(null, "", location.protocol + '//' + 
>> location.host + location.pathname + "/yourUrlPart");
>> 
>> -----Original Message-----
>> From: JumpStart <geoff.callender.jumpst...@gmail.com> 
>> Sent: torsdag 21. februar 2019 05:39
>> To: Tapestry users <users@tapestry.apache.org>
>> Subject: Browser History API
>> 
>> Has anyone made use of the browser History API with Tapestry AJAX calls?
>> 
>> I have an essentially single page app, all done with Zones and async event 
>> links. Tabs down one side flips between major functions (eg. Clients, 
>> Calendar, Billing), replacing the main pane contents, and clicking on 
>> buttons and links in the pane will often drill into a sub-function (eg. View 
>> Client, Pay Invoice). All requests are async=“true” and render Zones.
>> 
>> The problem is that the URL in the browser never changes, so if you choose 
>> Refresh then you’ll go back to the initially displayed page. 
>> 
>> But, the app does support query params in the URLs that can navigate to the 
>> right place (eg. ?fun=CLIENT&sub=UPDATE). I guess what I’d like is a way to 
>> tell AjaxResponseRenderer what URL I’d like handed to the browser History 
>> API, and for it to be done automatically.
>> 
>> Cheers,
>> 
>> Geoff
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to