paritytech / polkassembly

Polkassembly now has a new home:
https://github.com/Premiurly/polkassembly
Apache License 2.0
30 stars 37 forks source link

Make a backup copy of the new posts in local storage #1057

Open chevdor opened 3 years ago

chevdor commented 3 years ago

Similar to how Github does (for instance): if you start typing a comment, close the page and reopen it, your draft comment is still there.

The goal being to avoid the case where a user spends quite some time writing a long post that ends up vanishing. I think I even experienced that due to the fact that the Polkadot Extension lost the connection to the node (that happens...), re-established it right away, and as a result, the page reloaded, wiping my draft with no warning.

Not sure how this is done in Github, whether it is done per keypress or once in a while (like every 1s or 5s). Both solutions would be fine, I would be ok losing 5s of work but not more.

Tbaut commented 3 years ago

Storing the content of input upon refresh (just F5 or tab close then reopen last tab) is a standard behaviour provided by browsers. The reason that this does not happen on Polkassembly is because it's an SPA and all the DOM is injected using JS after the page has loaded, the browser will not populate input fields because the input aren't present when the page loads.

Storing content on keystroke or regularly sounds like the only solution, far from ideal though.

Just a comment regarding what you said on the extension, unlike Metamask, the polkadot-js extension is not connected to any node and it doesn't inject anything else than the users' accounts. Polkassembly itself is connected to a node (set as provider to polkadot-js api). This allows any user to actually see proposal outcomes etc in real time without needing an extension.