sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

SPFx List View Command Set with dialog not rendering

Open melvinschenker opened this issue 3 years ago • 36 comments

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

💥 SharePoint Framework

Developer environment

Windows

What browser(s) / client(s) have you tested

  • [ ] 💥 Internet Explorer
  • [X] 💥 Microsoft Edge
  • [X] 💥 Google Chrome
  • [ ] 💥 FireFox
  • [ ] 💥 Safari
  • [ ] mobile (iOS/iPadOS)
  • [ ] mobile (Android)
  • [X] not applicable
  • [ ] other (enter in the "Additional environment details" area below)

Additional environment details

  • browser version
  • SPFx version: 1.11.0, 1.16.0-rc.0, 1.16.0, 1.17.1, 1.17.2
  • Node.js version 10.24.0 , 16.17.0
  • etc

Describe the bug / error

Since 10th May 2023 our SPFx List View Command Sets on all our customers stopped working properly - all Extensions which use the @microsoft/sp-dialog BaseDialog class. When loading the library, sometimes the extension opens when we click on the command button, but after refreshing the page it won't show up and it doesn't work at all.

image

We noticed this behavior only on document libraries.

Has someone else had the same issues with List View Command Sets?

Steps to reproduce

  1. Navigate to library
  2. Select or not select a file
  3. Click on command button

Expected behavior

The SPFx List View Command Set should open the dialog.

melvinschenker avatar May 15 '23 08:05 melvinschenker

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

ghost avatar May 15 '23 08:05 ghost

I can confirm the same happens to us in EU. In debug mode I also get the following output: https://legacy.reactjs.org/docs/error-decoder.html/?invariant=321

Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons: 1. You might have mismatching versions of React and the renderer (such as React DOM) 2. You might be breaking the Rules of Hooks 3. You might have more than one copy of React in the same app See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.

This makes me think that a new package was rolled out with a later React version. Similar thing happened in February this year: https://github.com/SharePoint/sp-dev-docs/issues/8744

mmontvai avatar May 15 '23 14:05 mmontvai

I am having same issue too. Looks like it's @microsoft/sp-dailog issue. If I clear the cache then it works first time and after that it throw same error as @melvinschenker.

shakimran avatar May 15 '23 19:05 shakimran

We are experiencing this issue too, same prod deployment that was working fine last week is no longer operating as expected. Same error message as above, looks like going to the site contents page and navigating back seems to refresh the sp-dialog domElement reference and allows the dialog to load. This is affecting customers would love some clarity on any resolution :)

s3723766 avatar May 16 '23 00:05 s3723766

@melvinschenker @mmontvai @shakimran @s3723766 - thank you for bringing this up! Does any of you have a test tenant you could share with me where the error can be reproduced more or less consistently? I tested on various environments and was able to catch it just once, which is not enough to test/fix the issue.

You can share the tenant with me via email: [email protected]

Thanks!

AJIXuMuK avatar May 16 '23 12:05 AJIXuMuK

@AJIXuMuK We see the same issue happening on multiple tenants. What we see is that if you navigate to the document library with the list view command set button directly it works fine. But if you then navigate to the Home page of the site and then back to the document library via the left navigation, it's broken.

A CTRL+F5 will make it start working again, untill you navigate to the home page again.

advdberg avatar May 16 '23 13:05 advdberg

@advdberg - I tried navigation too. Still can't repro :( Do you mind also sharing you package.json?

AJIXuMuK avatar May 16 '23 13:05 AJIXuMuK

I had a the same issue on a document library. It seems to occurs randomly. Sometimes i have to refresh (F5 or CTRL F5) many times to be able to open the dialog box. It was working correctly till 10th of May.

I just updated today to last version of microsoft/sp-dialog": "1.17.2", but I still have the problem.

Here is my package.json "dependencies": { "@microsoft/decorators": "1.17.2", "@microsoft/sp-core-library": "1.17.2", "@microsoft/sp-dialog": "1.17.2", "@microsoft/sp-listview-extensibility": "1.17.2", "moment": "^2.29.4", "office-ui-fabric-react": "^7.204.0", "react-moment": "^1.1.3", "react-toastify": "9.0.3", "tslib": "2.3.1" }, "devDependencies": { "@microsoft/eslint-config-spfx": "1.17.2", "@microsoft/eslint-plugin-spfx": "1.17.2", "@microsoft/rush-stack-compiler-4.5": "0.2.2", "@microsoft/sp-build-web": "1.17.2", "@microsoft/sp-module-interfaces": "1.17.2", "@rushstack/eslint-config": "2.5.1", "@types/react": "^18.0.27", "@types/react-dom": "^18.0.10", "@types/webpack-env": "~1.15.2", "ajv": "^6.12.5", "gulp": "4.0.2", "typescript": "4.5.5" }

Julienregniaud avatar May 16 '23 16:05 Julienregniaud

@Julienregniaud - thanks for sharing the package.json. In your case you're missing a few things here. First of all, you need to add a dependency on "@fluentui/react": "^7.204.0" (same version as office-ui-fabric-react). Second, and very important, you need to add dependencies to React and ReactDom as well as correct the types dependencies for these libraries:

"dependecies": {
  "react": "17.0.1",
  "react-dom": "17.0.1",
},
"devDependencies": {
  "@types/react": "17.0.45",
  "@types/react-dom": "17.0.17"
}

Please, let me know if the issue is still there after all the changes.

AJIXuMuK avatar May 16 '23 16:05 AJIXuMuK

FYI - my package.json has all of those dependencies - other than "@fluentui/react" -- and adding that in did not fix anything.

teresahoes avatar May 16 '23 17:05 teresahoes

and just to be on the same page: adding dependencies meaning installing them, not just adding lines in the package.json. Also - could you please do npm ls --depth=4 and check what actual versions of office-ui-fabric-react, fluentui/react and react are in use in your solutions?

And still: if anyone could share the test tenant OR maybe .sppkg - it would be really helpful!

AJIXuMuK avatar May 16 '23 18:05 AJIXuMuK

Hi @AJIXuMuK -- i uploaded my sppkg file to an old solution issue https://github.com/AJIXuMuK/code-sharing/issues/1#issuecomment-1550179790

teresahoes avatar May 16 '23 18:05 teresahoes

I am also seeing this issue with two SPFx list view extensions, both of which use sp-dialog. I started hearing reports of problems around the 10th, clearing cache and cookies will temporarily fix it but it soon returns, so it sounds like the same issue.

Sometimes the buttons fail with no output in the console, sometimes they fail with a "Minified React error 321" error. I can't seem to get the error to happen when debugging, only in production.

Here's my package.json dependencies:

  "dependencies": {
    "@fluentui/react": "7.204.0",
    "@microsoft/decorators": "1.17.2",
    "@microsoft/sp-core-library": "1.17.2",
    "@microsoft/sp-dialog": "1.17.2",
    "@microsoft/sp-listview-extensibility": "1.17.2",
    "react": "17.0.1",
    "react-dom": "17.0.1",
    "tslib": "2.3.1"
  },
  "devDependencies": {
    "@microsoft/eslint-config-spfx": "1.17.2",
    "@microsoft/eslint-plugin-spfx": "1.17.2",
    "@microsoft/rush-stack-compiler-4.5": "0.2.2",
    "@microsoft/sp-build-web": "1.17.2",
    "@microsoft/sp-module-interfaces": "1.17.2",
    "@rushstack/eslint-config": "2.5.1",
    "@types/webpack-env": "~1.15.2",
    "@types/react": "17.0.45",
    "@types/react-dom": "17.0.17",
    "ajv": "^6.12.5",
    "gulp": "4.0.2",
    "typescript": "4.5.5"
  }

This is in Australia, by the way.

Tenant ID: 5876d301-936a-4dde-9c30-8bef24d1a0ff

dixonte avatar May 17 '23 03:05 dixonte

@AJIXuMuK Thanks for your answer

I did add dependencies as you mentionned then did a npm install, but it did not fix the issue.

Here is the result of npm ls --depth=4

+-- [email protected]

| | | +-- @fluentui/[email protected]  

| | | +-- [email protected] deduped

Also, just to be sure, our solution wa was working perfectly before the 10th of May. Then without any change in the code it did not work.

Julienregniaud avatar May 17 '23 06:05 Julienregniaud

Happened same to me, got into some details to capture what triggered this error and the Minified #321 was called due to a mismatch in React versioning between my base dependency (17.0.1) and the react on node_modules/@uifabric/utilities where the react version is 16.8.6

TomasRosello avatar May 17 '23 08:05 TomasRosello

We are seing the same issue for our solutions.

We are running:

SharePoint Framework v. 1.12.1 React 16.9.0

MortenGuldbaek avatar May 17 '23 12:05 MortenGuldbaek

Hello guys

I am working together with @melvinschenker who opened this issue. For the time being, we used a workaround and created the DOM Element by ourselves and used the Modal fluentui component. This works, as we're no longer relying on the sp-dialog package. For those interested, I will attach those files here:

WorkaroundDialog.txt WorkaroundModal.txt

We would still hope for a fix, as we have had this issues across multiple extensions on different versions.

EDIT: We also are not able to get the Extension to work again after clearing the cache. If it fails once, it is bugged forever.

FreakIsTea avatar May 17 '23 13:05 FreakIsTea

Please, could someone share test tenant with me? I've tried the solution provided by @teresahoes on multiple tenants using different browsers and OSs. Everything is working fine. I totally see it's a huge problem as many of you and your customers are affected and want to solve it ASAP.

AJIXuMuK avatar May 17 '23 16:05 AJIXuMuK

Please, could someone share test tenant with me?

@AJIXuMuK Sorry, I'm not sure what this means. I did post the ID of the tenant where I'm seeing this issue above. Or did you mean a tenant specifically made for testing?

dixonte avatar May 18 '23 01:05 dixonte

@dixonte sorry for not clarifying. I mean if someone could either give me guest access or share some test credentials for the tenant where the issue can be reproduced - it would be awesome! You can share it vis email: [email protected]

AJIXuMuK avatar May 18 '23 01:05 AJIXuMuK