Fix: Display persisted draft agreement #4148
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Agreements
page directly from local storage. However, given the component might not re-render, the draft agreement wouldn't always be rendered. The solution was to make use ofRedux
store which already saves this value and re-populates the store with the values persisted in the local storage on page refresh.Save draft
is oftype=button
and nottype=submit
, the error message was not showing up, but neither was the draft saved. In this case, the solution was to wrap the click handler withhandleSubmit
from the form context.Note
In the initial issue it was thought it has to do with the
Reputation
extension version, but the draft was saved in the local storage and only a few attempts it did appear on theAgreements
page.Check recording here
Important
If you do however want to test this with a lower version of the
Reputation
extension (eg.v11
), give me a sign and I'll provide more guidance until I'll update theNotion
page - bit shoutout to @area on this 🙏 and to @iamsamgibbs for guiding me to theRedux
storeTesting
TODO: Let's test we can actually save a draft agreement and it will appear in the
Agreements
page without issues.Reputation
extensionCreate agreement
, clickSave draft
.Screen.Recording.2025-01-20.at.21.47.20.mov
It should be rendered and you can see the entry in the local storage. Try to edit it, close it, delete it, create another one etc.
node scripts/create-colony-url.js
Reputation
extensionCreate a new agreement
from the side navigation (alternatively you can go to theAgrements
page as before, it doesn't really matter)Save draft
.No reputation
warning should be shownScreen.Recording.2025-01-20.at.21.53.35.mov
If you have more testing ideas in mind, do not hesitate to try them out
Diffs
Changes 🏗
getDraftDecisionFromLocalStorage
withuseSelector(getDraftDecisionFromStore(...))
for thedraftAgreement
onClick
handler withhandleSubmit
forSaveDraftButton
componentResolves #3826