I have an onboarding flow that a user completes before creating a secure account. I need to store all of the data from the 7 steps of onboarding, and once an account is created insert this data assigned to the user_id.
I’m trying to use Local Storage Manager so that the user can return to complete the onboarding later.
I’ve created the schema, with an array and an id. E.g. locations.id
on:click I then wish to insert this to the array, there are multiple id’s that will need to be inserted into the same ‘locations’ array.
However, with the UI options I have, it only provides ‘set’ as the option and thus overwrites the id each time.
Is this a current known limitation or am I missing something obvious?
Maybe use the array component on your page for this. Create an array and onclick use the add / add unique value to the array.
Array component dynamic events > value updated set the array component value in a local storage using the set action. And finally, to load the data store items into the array, just select the local storage value as dynamic value for the array component.
So the logic is - you add an item in the array component, it then stores it / updates the local storage value and on page reload (visitor comes back) the local storage will load the values inside the array component.
I’m familiar with arrays however this would require at least 7 to be used, so was hoping that the session or local storage would handle this as a single component.
Couple of follow up questions here if you don’t mind;
You mention local storage and data store, would you recommend for this use case local storage manager, or the data store?
onclick event of the button (which has the item name and value) I add this to array, which then sets value to the local storage manager (currently). However, if someone clicks the same button that was already included in the array, I want to do one of two things depending on the specific section.
i) remove that item if it already exists in the array
ii) a second click adds that item to another datapoint in the array as ‘more important’, and a third click removes it entirely from the array.
I have this working with a ternary however wondered if there was a better approach to handle this?
Thanks Teo - I always strive for the simplest, cleanest option - which isn’t always apparent to me - I’ll stick with Ternary for now as I haven’t been able to get to a good level with Flows yet.