preline icon indicating copy to clipboard operation
preline copied to clipboard

Uncaught TypeError: Cannot read properties of null (reading 'closest') at e.closeCurrentlyOpened

Open balibou opened this issue 2 years ago • 0 comments

Working with ^1.7.0 not working with ^2.0.0

I'm using Nextjs (and used this https://preline.co/docs/frameworks-nextjs.html) I have this error:

Uncaught TypeError: Cannot read properties of null (reading 'closest') at e.closeCurrentlyOpened (preline.js:2:50437) at eval (preline.js:2:51797)

Usecase 1: in a Navbar, isUserLoggedIn (a boolean) display a button LogIn when it's true. When I'm logged in (isUserLoggedIn = false), a dropdown button with an avatar is displayed. When I click on logout (which is a dropdown menu item and set isUserLoggedIn to false), I get this error.

Also another issue, the dropdown doesn't display the menu list when switching from not logged in to logged in. Usecase 2: When I log in, the dropdown button is shown but when I click on it, nothing happens

Repo: https://stackblitz.com/edit/preline-nextjs-d8ppyt (only usecase 2 on stackblitz because I can't open the menu list) npm i then npm run dev (don't forget to switch preline between ^1.7.0 and ^2.0.0 to see the difference)

balibou avatar Nov 11 '23 21:11 balibou