2

I have a list lwc component on page 1.. and details component on page 2

Page 1 has "list component" user decides to filter the list to show only records created the month of May. users find a line item on that list then selects the button to view details. We use navigation mixing to navigate the user to page 2 that has the details "details component".

When user hits the back button to return to page 1 ("list component"). Problem is that the component is re initialized and the user has lost the filters they had selected.

Is there a build in way in LWC/Communities to store page previous page component state? or do we have to use something like js sessionStorage?

2

There is no "built in way" to store this, you can either create an object to store the state, use a record of the object if applicable, or use a browser storage option to restore the state of the view.

LocalStorage is supported in lwc, and you also have other options available depending on the amount of data that you need to store.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.