2

I created a SPFx BaseListViewCommandSet extension. My component puts the status of all selected rows. The update works well.

However, when I want to refresh the page (location.reload ();) at the end of the OnExecute method, the page does not refresh.

In debug mode, the page refreshes, in package deployed mode, the page does not refresh.

@override
  public onExecute(event: IListViewCommandSetExecuteEventParameters): void {
  //code ...
  location.reload ();
}

enter image description here

I still used reload(true); and reload(false);

Any Idea ?

2 Answers 2

0

Maybe a screenshot of the code before the location reload will be a big help in this case.

location.reload()

should work, try debugging your code remove the codes before the location reload then if it does reload something wrong with your code that prevents the processor to reach the line where location.reload is, have you tried looking at your console during the process?

you can also try this 1 if your goal is just to refresh the page

location.replace(location.href)

Hope the concept helps! Happy Learning!

2
  • Hi ! Thank you, you are right, something gone wrong with the package. The problem was in button configuration, it was not update. (i forgot --ship with bundle command). So after "gulp bundle --ship" and "gulp package-solution --ship", everything was okay. Apr 21, 2020 at 16:07
  • Awesome! Good to know you did solved it! :)
    – Edwin
    Apr 22, 2020 at 11:11
0

Try accessing in different browsers - if the issue still persists, try the below:

Try using passing the boolean parameter:

Syntax:

location.reload(forceGet)

Example:

location.reload(true)

Explanation:

  • true - Reloads the current page from the server
  • false - Default. Reloads the current page from the cache.
1
  • thank you for your helps. I tried too this option, but it' doesn't work. Apr 20, 2020 at 12:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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