0

So I have this setup where I have a searchfield that, upon button click, navigates to a results screen where there is a lightning datatable. Now, the problem is that if I go back from the results to the search and search for a new key, it will still show me the old results on the results screen.

Am only using lightning, no aura or VF pages.

My question: Is there a way to 'destroy' or 'clear' a page when I navigate back using the inherent back-button? EDIT: The real problem here is that the results page is not refreshed, since I can just refresh my browser page and then it will actually show the newer results. Just not after navigation is called, automatically. Results are not cached.

Thanks in advance.

I navigate like so:


    this[NavigationMixin.Navigate]({
         type: 'standard__component',
         attributes: {
                componentName: 'c__ResultsTab'
             },
         state: {
                c__data: JSON.stringify(this.foundData)
             }
         });

in the result screen controller I do:

@api set data(value) {
        this.items = [];
        this.items = JSON.parse(value);
    }

As far as I can see set data() isn't called anymore after I enter this screen for the first time.

So, what I want to do: Search a > results a > back to Search > Search b > results b

what I get: Search a > results a > back to Search > Search b > results a

  • ResultsTab - is this aura component? – salesforce-sas Jul 30 at 8:26
  • As I said, I'm only using lightning, no aura or VF pages. – Temojikato Jul 30 at 8:45
  • it is actually not possible to navigate to LWC component directly according to documentation. Can you please show full code. – salesforce-sas Jul 30 at 8:52
  • Unfortunately I can't really do that. I can make a dummy version for you, sure. However, ... developer.salesforce.com/docs/component-library/bundle/… ? – Temojikato Jul 30 at 13:14
  • I worked on both aura and LWC. I will be able to help you if you show atleast a working demo here in question – salesforce-sas Jul 30 at 13:41

Your Answer

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

Browse other questions tagged or ask your own question.