Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dialog Alert won't close due to: Uncaught (in promise) TypeError: resolve is not a function #124

Open
KostjaStein opened this issue Jan 4, 2022 · 5 comments

Comments

@KostjaStein
Copy link

How to reproduce:

  1. go to: https://c0bra.github.io/svelma/components/dialog/
  2. click "Dialog" button
  3. click "OK" button (within alert dialog)

Dialog won't close, console output:
Uncaught (in promise) TypeError: resolve is not a function
at
HTMLButtonElement.confirm (Dialog.svelte:146)

Dialog.svelte:146
resolve(hasInput ? prompt: true)

Dialog.svelte:85-87
// export let showClose = true
let resolve
// export let promise = new Promise((fulfil) => (resolve = fulfil))

@abbychau
Copy link
Collaborator

abbychau commented Jan 6, 2022

The doc and demo was outdated. I have just updated the doc link.

https://docs-abbychau.vercel.app/svelma/components/dialog

@KostjaStein
Copy link
Author

Thank you! The documentation demo (at the adress you provided) is working.
However, the same issue occures within the library itself. I'm using the library (version 0.4.5) and observe the same behavior as was/is present in the doc demo (at this adress: https://c0bra.github.io/svelma/components/dialog/).
I'm not sure however, whether the problem is caused by the fact, that i'm using TypeScript for my project. I will give it a try to solve the issue and on sucess post the fix to help other TypeScript users.
Do you have any hint what may cause the problem if the library is used within a TypeScript project?

@mcurcija
Copy link

mcurcija commented Mar 9, 2022

You could link with git main branch instead of using 0.4.5

git clone https://github.com/c0bra/svelma.git
cd my-project 
pnpm link ../svelma 

devDependencies:
- svelma 0.4.5
+ svelma 0.4.5 <- ../svelma

@mcurcija
Copy link

mcurcija commented Mar 9, 2022

Build from local git is also fine

cd svelma 
pnpm run build 
cd public/build
pnpm pack 

During pack svelma-0.4.5.tgz is created in project root. Copy svelma-0.4.5.tgz to the root of your project and do following (don't forget to unlink if it was linked as suggested in previous comment):

# remove first
pnpm rm -D svelma
# and add local package instead
pnpm add -D file:svelma-0.4.5.tgz

@CherryDT
Copy link

CherryDT commented May 6, 2022

Any update on this? The public version seems to be still broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants