Sp-dev-docs: Command Set Customizer, Application Customizer: onDispose has never been called

Created on 28 May 2019  路  8Comments  路  Source: SharePoint/sp-dev-docs

Category

  • [ ] Question
  • [ ] Typo
  • [x] Bug
  • [ ] Additional article idea

Expected or Desired Behavior

onDispose is called for Command Set and Application customizers at lease when event similar to page navigation are appeared.

Observed Behavior

onDispose has never been called

Steps to Reproduce

  1. Create Application Customizer and/or Command Set Customizer extension using Yeoman generator
  2. Add
@override
  public onDispose() {
    alert('on Dispose');
  }
  1. gulp serve
  2. Navigate from page to page -> no alerts
spfx-extensions spfx-general tracked working-on-it bug-confirmed

All 8 comments

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

So the app customizer should only get disposed when the host app is disposed. Hopefully not on a page to page navigate. Any chance you can check to see if this is targeted release only?

@patmill - any type of tenant.
I don't see these events fired on Standard and Targeted Release tenants.
Maybe for app customizer it's a valid statement. But what about Command Set?

I would expect that they are called, yes.

BTW, same with Field Customizer. onDisposeCell is called, which is good. But onDispose that is for the whole Customizer - not.

onDispose does work with ApplicationCustomizers. I was able to get it to work when I did an in-place navigation between sites from a modern page that has an ApplicationCustomizers to one that doesn't have an ApplicationCustomizer. Since disposeExtension gets hit and onDispose gets reached (onDispose comes from BaseComponent), I think the issue is that the logic to when a certain extension gets disposed isn't documented and not intuitive (if it is please provide a link).

This issue has been automatically marked as stale because it has marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within the next 7 days of this comment. Please see our wiki for more information: Issue List Labels: Needs Author Feedback & Issue List: No response from the original issue author

We need documentation for sure... I'm still confused about when it's called when it's not.
Especially because not many devs know that "Page" and "List" are 2 different SPAs inside SharePoint.

Was this page helpful?
0 / 5 - 0 ratings