ampproject / ampproject/amphtml

How can I reset amp-states after submitting form or on click to go back to the page (Safari)?

Open
#35,118 4 comments 0 reactions 1 assignee Claimed by @samouri View on GitHub
Stale Type: Bug
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

### Description

I am using amp-states on jsp page. I change text of button to 'Loading...' on submitting form, then redirects me to another page. When I click to go back, I see that the button text is still 'Loading...'. That is, the state is not reset to the initial value. I use submit-success for reseting state(isLoading), but it is not work. This bug is reproducible in Safari and Firefox, it is not reproduced in Google Chrome. Why is this happening? How to fix it? I am ready to consider alternative options, without amp-states.

```


{
"isLoading": false
}







```

### Reproduction Steps

You can see the live example on the site https://www.upnest.com/re/ You should enter some city and click on button, then you see 'Loading on the button'. Then if you click to go back to preview page, you will see that the button did not return to 'Compare Agent'

### Relevant Logs

_No response_

### Browser(s) Affected

Firefox, Safari

### OS(s) Affected

_No response_

### Device(s) Affected

_No response_

### AMP Version Affected

2106182132000

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.