-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1958 from alphagov/adr-007-for-ssa-ajax
Adds ADR for SSA Ajax
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
docs/arch/adr-007-dont-use-asynchronous-javascript-for-simple-smart-answers.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# ADR007 – Don’t use asynchronous javascript for simple smart answers | ||
|
||
Date 2023-11-06 | ||
|
||
## Status | ||
Accepted | ||
|
||
## Context | ||
There was some work to make the Mainstream publisher user interface more user friendly around 2015 by introducing an asynchronous post back mechanism that posted current edit state to the server without posting the page and requiring a page refresh. | ||
|
||
This commit comment explains that at the time, Simple Smart Answers (SSA) was excluded from the work | ||
https://github.com/alphagov/publisher/pull/358/commits/74e4d135d9619cf799935b8ca2ea45cffc62f2d3 | ||
|
||
> **Don't save simple smart answers using ajax**. Javascript form construction is too complex to handle validation | ||
without a full page reload, at least for now. | ||
|
||
This has been revisited recently as users have requested the asynchronous postback feature to be added to Simple Smart Answers. | ||
|
||
Similar to Guides (which are made up of smaller components called Parts), SSA also need a separate module that handles its own smaller components (Nodes) more gracefully. This will allow us to use Snackbars with SSA and validations will be handled correctly in all parts of the SSA form, following current convention the module could be called ajax_save_with_nodes.js | ||
|
||
It was decided that the effort to create a well tested ajax_save_with_nodes.js module for SSA, is not something we have capacity for within the team at this time. Although there is benefit for the users to have features such as Snackbars, there is a possibility that we may be moving Publisher over to the GDS Design System, where Javascript is not permitted, meaning Snackbars may end up being removed from publisher entirely, making the effort redundant. | ||
|
||
## Decision | ||
We will not implement asynchronous javascript saves for the simple smart answers content type in publisher | ||
|
||
## Consequences | ||
- The Simple Smart Answers content type will continue to do a full post back on save | ||
- Additional work that depends on the async postback will be archived, for example retaining scroll position on save | ||
|