xiaoluoboding / vue-sonner

🔔 An opinionated toast component for Vue.

Home Page:https://vue-sonner.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: Can't create new toasts after dismiss

dewodt opened this issue · comments

Enviroment

System:
OS: Linux 6.5 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
CPU: (8) x64 Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
Memory: 6.59 GB / 15.45 GB
Container: Yes
Shell: 5.8.1 - /usr/bin/zsh
Binaries:
Node: 21.7.1 - /usr/bin/node
Yarn: 1.22.21 - /usr/bin/yarn
npm: 10.4.0 - /usr/local/bin/npm
pnpm: 8.15.4 - /usr/bin/pnpm
bun: 1.0.25 - ~/.bun/bin/bun
Browsers:
Chrome: 122.0.6261.111

Dependencies:

{
  "dependencies": {
    "vue": "^3.4.15",
    "vue-router": "^4.2.5",
    "vue-sonner": "^1.1.2"
  },
  "devDependencies": {
    "@rushstack/eslint-patch": "^1.3.3",
    "@tsconfig/node20": "^20.1.2",
    "@types/node": "^20.11.10",
    "@vitejs/plugin-vue": "^5.0.3",
    "@vue/eslint-config-prettier": "^8.0.0",
    "@vue/eslint-config-typescript": "^12.0.0",
    "@vue/tsconfig": "^0.5.1",
    "eslint": "^8.49.0",
    "eslint-plugin-vue": "^9.17.0",
    "npm-run-all2": "^6.1.1",
    "prettier": "^3.0.3",
    "typescript": "~5.3.0",
    "vite": "^5.0.11",
    "vue-tsc": "^1.8.27"
  }
}

Issue

Cannot create a new toasts after dismissing a toasts.

Expected Behavior:

Calling a new toasts should appear even after dismissing a toasts. Atleast it works this way in emilkowalski's sonner library.

Example:

<script setup lang="ts">
import { Toaster, toast } from 'vue-sonner'
const handleClick = async () => {
  // Show a toast
  const loadingToast = toast.loading('Loading...')

  // Simulate an API call
  await new Promise((resolve) => setTimeout(resolve, 4000))

  // Dismiss the toasts
  toast.dismiss(loadingToast)

  // Show a success toast
  // ERROR: NOT SHOWING
  toast.success('Success!')
}
</script>

<template>
  <button @click="handleClick">Tes</button>
  <Toaster />
</template>

Demo

vue-sonner-demo.webm

Logs

image

Same @xiaoluoboding please see this

@dewodt did you find an answer?

@dewodt did you find an answer?

Not yet, I haven't got time to find the bug in the source code.