peakshift / makers.bolt.fun

https://makers.bolt.fun
GNU General Public License v3.0
31 stars 21 forks source link

Fix: Storing create-story inputs values in local cache causing conflicts #226

Closed MTG2000 closed 1 year ago

MTG2000 commented 1 year ago

Originally, we only had 2 ways for the user to enter the "write-story" page:

So in the case of writing a new story, we were using localStorage to cache the values of the inputs fields, so that if the user reloads the page, the inputs will still have the values they had.

However, lately, we've added a new way to enter to the write-story page, and that's from the topics page. Where the Tag input field will be pre-filled with the tag that the user were on.

But what will happen if the user has already had some cached data in the localStorage? Should we delete that data?? Ignore that data??

And when he starts writing his new story, should we write over the cached values in the localStorage? Or if there is some data there but it's been ignored, should we NOT write to the localStorage?

Johns suggested a solution where we keep a local cache FOR EACH different topic, and one cache for the NO-TOPIC case. This could solve some aspects of the problem, but it brings its own challenges with it too. (Primarily that we will need to add a new components to the "write-story" page that shows all the cached different stories with the ability to "restore them back in". But this feels very close to Drafts, so maybe we should think of something a little different)

I think we should look into other websites who have scenarios similar to ours, & see how they are handling it.

MTG2000 commented 1 year ago

Actually, after thinking about it more... I think that having a separate cache for each topic might be a good idea.

And that's for several reasons:

So following this approach, our cache logic would look something like this simplified diagram:

Untitled
johnsBeharry commented 1 year ago

If we're going this route then we will also need to have a unique parameter (the topic slug) in the URL so it is shareable.

Something like /write-story?topic=TOPIC_SLUG

MTG2000 commented 1 year ago

If we're going this route then we will also need to have a unique parameter (the topic slug) in the URL so it is shareable.

Something like /write-story?topic=TOPIC_SLUG

It's already being done this way, right??

ex: https://makers.bolt.fun/story/write?tags=100DaysOfBitcoin

johnsBeharry commented 1 year ago

Oops it seems so. I remembered sometime I tried it and I didn’t see but maybe I was on the global feed.

On Tue, 17 Jan 2023 at 19:47, Mohammed Taher Ghazal < @.***> wrote:

If we're going this route then we will also need to have a unique parameter (the topic slug) in the URL so it is shareable.

Something like /write-story?topic=TOPIC_SLUG

It's already being done this way, right??

ex: https://makers.bolt.fun/story/write?tags=100DaysOfBitcoin

— Reply to this email directly, view it on GitHub https://github.com/peakshift/makers.bolt.fun/issues/226#issuecomment-1385876251, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABMWZDGECPMNWAGIPEKGMDWS3SKTANCNFSM6AAAAAAT4W2P4U . You are receiving this because you commented.Message ID: <peakshift/makers .@.***>

-- [image: Peak Shift Inc.]

Johns Beharry PRINCIPAL / PEAK SHIFT INC. › WEB: PEAKSHIFT.COM http://peakshift.com › FACEBOOK: FB.COM/PEAKSHIFT http://facebook.com/peakshift › TWITTER: @PEAKSHIFT http://twitter.com/peakshift › SKYPE: JOHNSBEHARRY › PHONE: +442032872811