Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The handling of postDraft from local session storage is buggy. #104

Closed
asimons04 opened this issue Aug 16, 2023 · 2 comments
Closed

The handling of postDraft from local session storage is buggy. #104

asimons04 opened this issue Aug 16, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@asimons04
Copy link

asimons04 commented Aug 16, 2023

Describe the bug
While I can see the benefit of keeping drafts somewhere (Lemmy does not have this functionality natively and it's something people have asked for), the way it is in Photon is causing more problems that it's solving.

Specifically, this is causing "misfires" where posts are sent to the wrong community and/or with the wrong or inappropriate URL/image/body from a prior draft.

Specific Issues
Issue 1: I can't reproduce this consistently, but sometimes the community that pre-fills when you click Create -> Post is the one from the saved draft instead of the one you are in. Possibly related to observed behavior mentioned in #101

Issue 2: An abandoned post for one community bleeds over by pre-filling new posts from that draft for any other community.

Issue 3: With all of the, IMO unnecessary, placeholder values in the form elements, it's difficult to distinguish whether things like the URL are set from an earlier/unrelated draft or just a placeholder in an empty field.

To Reproduce (if applicable)
Unfortunately, I cannot reproduce issue 1 consistently. The rest can be reproduced as below:

  1. Click into a community and then create-> post
  2. Enter a title/url/image, and post body. Don't submit.
  3. Click back to front page (abandon the post you started)
  4. Click on another community
  5. Click "Create -> Post"
  6. The draft details are from the unrelated, abandoned post from earlier. Also, sometimes the community doesn't change to the current one (again, that part, I'm unable to reproduce consistently).

Potential Solutions

  1. Make saving post drafts an explicit/opt-in action rather than done automatically (e.g. add a "save as draft" button that would then store it to local session storage).
    a. In line with the above, store drafts in local storage more granularly so that drafts are saved on a per-community basis.
    b. Don't load drafts automatically. Also make that an explicit action with a "Restore Draft" button if a draft post is found in local storage for the community you're posting in.

  2. Get rid of placeholder text to make fields populated from a draft more apparent. Mentioned in feature request Since placeholder text is dynamically generated, make it optional via env var #107

Versions

  • Browser: Firefox, Chromium
  • Photon version: 0.8.4
@asimons04 asimons04 added the bug Something isn't working label Aug 16, 2023
@asimons04
Copy link
Author

Doing a custom build and nuking all of the draft logic in src/lib/components/lemmy/post/PostForm.svelte is my current workaround.

@Xyphyn
Copy link
Owner

Xyphyn commented Aug 16, 2023

I decided to add a manual "restore from draft" button.

@Xyphyn Xyphyn closed this as completed Aug 16, 2023
Xyphyn added a commit that referenced this issue Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants