parse-dashboard icon indicating copy to clipboard operation
parse-dashboard copied to clipboard

fix: Class Level Permissions dialog throws error `TypeError: ce.current is null`

Open devbymak opened this issue 1 year ago • 6 comments

New Pull Request Checklist

  • [x] I am not disclosing a vulnerability.
  • [x] I am creating this PR in reference to an issue.

Issue Description

Closes: #2547

Approach

The SecurityDialog component is rendered based on the existence of the "perms" value, which is subject to a delay as it is fetched. In this scenario, if the user clicks on the menu item and the "perms" value isn't ready, the value of "clpDialogRef" will be null.

TODOs before merging

  • [ ] Add tests
  • [ ] Add changes to documentation (guides, repository pages, in-code descriptions)

devbymak avatar Apr 24 '24 10:04 devbymak

Thanks for opening this pull request!

I will reformat the title to use the proper commit message syntax.

@mathieulb would you like to test this out, whether it fixes your reported issue?

mtrezza avatar Apr 25 '24 13:04 mtrezza

This is the first time I try installing it from Github, I think.

I did git fetch origin pull/2549/head:pull_2549, then git checkout pull_2549, then npm i, then npm run dev, then I get export 'useId' (imported as 'useId$1') was not found in 'react' in ../node_modules/@graphiql/react/dist/index.es.js lines 6152 & 6153, and Module not found: Error: Can't resolve 'crypto' in 'node_modules/bcryptjs/dist', BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

But apparently it runs anyway, so I logged into dashboard and created a new class and some columns and no data, and then pressed Security -> Class Level Permissions, and I still didn't get any dialog box, but this time without any error in the javascript console. Then I pressed on some other class name on the left and then the CLP dialog suddenly appeared, but it doesn't say for which class this CLP dialog is for. I tried again a few times, same thing. Then I cleared the cache & site data, and logged in again, and this time it worked correctly. But I think that it's the first time I ever tried parse dashboard on port 4040 of 127.0.0.1... every other time, I was using another port number, due to loading it as a npm dep in my parse server. So I don't know how it managed to fail at first, but now I can't get it to fail anymore. (Is that good news ?)

mathieulb avatar Apr 29 '24 01:04 mathieulb

Thanks for testing. The preview environment should work again now, so it will be easier to try this out. Let's see if it appears here in a few minutes...

mtrezza avatar Apr 29 '24 11:04 mtrezza

Uffizzi Ephemeral Environment deployment-50953

:watch: Updated Apr 29, 2024, 11:17 UTC

:cloud: https://app.uffizzi.com/github.com/parse-community/parse-dashboard/pull/2549

:page_facing_up: View Application Logs etc.

What is Uffizzi? Learn more

uffizzi-cloud[bot] avatar Apr 29 '24 11:04 uffizzi-cloud[bot]

I tested in the preview env:

  1. Create new class "Test"
  2. Create column "s" type String
  3. Click Security > CLP

The result for me is as @mathieulb described: no error log in the JS console, but also no CLP dialog appears.

Click on Refresh button in the data browser does not help, but reloading the entire page by clicking on the page reload button of the browser helps, then the dialog appears when clicking on Security > CLP.

If the class is created server-side, and the default ACL is also set server side, and the permissions need to be fetched from the server after creating the class, then maybe fetching that right after class creation would solve the issue, if both are async operations?

mtrezza avatar Apr 29 '24 12:04 mtrezza

Actually, on creating and dropping a class, the value of clp in the Browser component state was not being updated.

New changes were pushed.

devbymak avatar Apr 29 '24 14:04 devbymak

Uffizzi Ephemeral Environment deployment-50992

:watch: Updated Apr 29, 2024, 17:17 UTC

:cloud: https://app.uffizzi.com/github.com/parse-community/parse-dashboard/pull/2549

:page_facing_up: View Application Logs etc.

What is Uffizzi? Learn more

uffizzi-cloud[bot] avatar Apr 29 '24 17:04 uffizzi-cloud[bot]

🎉 This change has been released in version 6.0.0-alpha.2

parseplatformorg avatar Apr 30 '24 21:04 parseplatformorg

🎉 This change has been released in version 6.0.0-beta.1

parseplatformorg avatar May 16 '24 17:05 parseplatformorg