Skip to content

When navigating from one folder to another, the navigatedEvent doesn't fire. #4557

@dhruvp29

Description

@dhruvp29

Category

  • Question
  • Typo
  • Bug
  • Additional article idea

Expected or Desired Behavior

When we navigate between the folders in document library then it should fire the navigatedEvent.

Observed Behavior

I have some logic based on which folder User is in. But it fails as when I navigates between the folder the navigatedEvent is not firing.

Steps to Reproduce

Go to Root Folder add some console and then navigate to any sub folder and write the querystring in console so you can check whether the event fired or not.

Here is the code snippet.

@override
 public onInit(): Promise<void> {
    this.context.application.navigatedEvent.add(this, this._renderPlaceHolders);
   
     return Promise.resolve<void>();
 }
  private _renderPlaceHolders(): void {

  let queryParms = new UrlQueryParameterCollection(window.location.href);
   let myParm : string = decodeURIComponent(queryParms.getValue("id"));
   console.log("QUery String: " + myParm);

   console.log("HelloWorldApplicationCustomizer._renderPlaceHolders()");
   console.log(
     "Available placeholders: ",
     this.context.placeholderProvider.placeholderNames
       .map(name => PlaceholderName[name])
       .join(", ")
   );

   // Handling the top placeholder
    {
     const topPlaceholder  = this.context.placeholderProvider.tryCreateContent(
       PlaceholderName.Top,
       { onDispose: this._onDispose }
     );

     // The extension should not assume that the expected placeholder is available.
     if (!topPlaceholder) {
       console.error("The expected placeholder (Top) was not found.");
       return;
     }

     if (this.properties) {
       let topString: string = this.properties.Top;
       if (!topString) {
         topString = "(Top property was not defined.)";
       }

       if (topPlaceholder.domElement) {
         topPlaceholder.domElement.innerHTML = `
         <div class="${styles.app}">
           <div class="${styles.top}">
             <i class="ms-Icon ms-Icon--Info" aria-hidden="true"></i> ${escape(
               topString
             )}
           </div>
         </div>`;
       }
     }
   }

   // Handling the bottom placeholder
 {
   const bottomPlaceholder  = this.context.placeholderProvider.tryCreateContent(
       PlaceholderName.Bottom,
       { onDispose: this._onDispose }
     );

     // The extension should not assume that the expected placeholder is available.
     if (!bottomPlaceholder) {
       console.error("The expected placeholder (Bottom) was not found.");
       return;
     }

     if (this.properties) {
       let bottomString: string = this.properties.Bottom;
       if (!bottomString) {
         bottomString = "(Bottom property was not defined.)";
       }

       if (bottomPlaceholder.domElement) {
         bottomPlaceholder.domElement.innerHTML = `
         <div class="${styles.app}">
           <div class="${styles.bottom}">
             <i class="ms-Icon ms-Icon--Info" aria-hidden="true"></i> ${escape(
               bottomString
             )}
           </div>
         </div>`;
       }
     }
   }
 }

I already checked #1254 which states the issue if fixed but I am still facing this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:spfxCategory: SharePoint Framework (not extensions related)area:spfx-extensionsCategory: SharePoint Framework Extensionsstatus:working-on-itKnown issue / feature being addressed. Will use other "status:*" labels & comments for more detail.type:bug-confirmedConfirmed bug, not working as designed / expected.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions