janboddez / share-on-mastodon

Easily share WordPress posts on Mastodon.
https://jan.boddez.net/wordpress/share-on-mastodon
GNU General Public License v3.0
39 stars 5 forks source link

Errors not cleared #81

Closed janboddez closed 1 year ago

janboddez commented 1 year ago

Just writing it down so I don't forget. There's an issue in gutenberg-new where errors don't get cleared after a successful post. Might be because we override the custom field with the old value still present in the editor's store.

Not sure why it works on URLs then. But we may have to push the "new" URL, and the new "error," which may be an empty string, to the server with each update.

janboddez commented 1 year ago

If a post is too long, for example, and then made shorter and shared OK, the old error is still "present" in the editor and can get saved (on the condition that another meta value is also updated) once more, even though there no longer is an issue.

The same is true for URLs, most likely. It's just that it needs to be empty still, in the store, and then sharing has to be disabled or the "custom status" modified, and that all has to be saved, which is not something people tend to (?) do after the fact. Or if they do, that'll be later, and by then the URL will be loaded OK in the editor, too.

janboddez commented 1 year ago

Updating both using setMeta might also lead to issues, it would seem. What if the URL fetched through our API endpoint is empty still, but the post went through (in the background) half a second after that? Upon update, the front end will then save the empty string--but, presumably, only if something else also changed--over the actual URL, and it will be forgotten.