Skip to content

Commit 624bb99

Browse files
committed
fix: replace deprecated substr with substring and add type annotations
1 parent 3933ea6 commit 624bb99

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/context/ToastContext.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export function ToastProvider({ children }: { children: ReactNode }) {
4343
(message: string, type: ToastType = 'info', duration = DEFAULT_TOAST_DURATION) => {
4444
circuitBreaker.execute(
4545
() => {
46-
const id = Math.random().toString(36).substr(2, 9);
46+
const id = Math.random().toString(36).substring(2, 11);
4747
setToasts((prev: ToastMessage[]) => [...prev, { id, type, message, duration }]);
4848

4949
if (duration > 0) {
@@ -57,7 +57,7 @@ export function ToastProvider({ children }: { children: ReactNode }) {
5757
// Fallback: Log to console when circuit is open
5858
console.warn('[Toast Circuit Breaker] Toast notification suppressed:', { type, message });
5959
// Optionally show a simplified fallback toast
60-
const id = Math.random().toString(36).substr(2, 9);
60+
const id = Math.random().toString(36).substring(2, 11);
6161
setToasts((prev: ToastMessage[]) => [...prev.slice(-2), { id, type: 'info', message: 'Notifications temporarily limited', duration: 3000 }]);
6262
if (duration > 0) {
6363
setTimeout(() => {

0 commit comments

Comments
 (0)