File tree Expand file tree Collapse file tree 4 files changed +27
-335
lines changed
Expand file tree Collapse file tree 4 files changed +27
-335
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11'use client' ;
22
3- import { useState , useEffect } from 'react' ;
3+ import { useState , useEffect , useCallback } from 'react' ;
44import { useShowPopup } from '@vkruglikov/react-telegram-web-app' ;
55import { useRouter } from 'next/navigation' ;
66import { pluginsApi , Plugin , api } from '@/utils/api' ;
@@ -13,7 +13,7 @@ export default function MyPlugins() {
1313 const [ error , setError ] = useState < string | null > ( null ) ;
1414 const [ userId , setUserId ] = useState < number | null > ( null ) ;
1515
16- const loadMyPlugins = async ( ) => {
16+ const loadMyPlugins = useCallback ( async ( ) => {
1717 try {
1818 setLoading ( true ) ;
1919
@@ -42,11 +42,11 @@ export default function MyPlugins() {
4242 } finally {
4343 setLoading ( false ) ;
4444 }
45- } ;
45+ } , [ showPopup ] ) ;
4646
4747 useEffect ( ( ) => {
4848 loadMyPlugins ( ) ;
49- } , [ ] ) ;
49+ } , [ loadMyPlugins ] ) ;
5050
5151 const handleDeletePlugin = ( plugin : Plugin ) => {
5252 showPopup ( {
@@ -142,7 +142,7 @@ export default function MyPlugins() {
142142
143143 { plugins . length === 0 && ! error && (
144144 < div className = "text-center py-8 text-white/40" >
145- < p > You haven' t uploaded any plugins yet</ p >
145+ < p > You haven' t uploaded any plugins yet</ p >
146146 < button
147147 className = "mt-4 px-4 py-2 bg-primary/20 text-primary rounded-lg hover:bg-primary/30 transition-colors"
148148 onClick = { ( ) => router . push ( '/plugins/upload' ) }
Original file line number Diff line number Diff line change 11'use client' ;
22
3- import { useState , useEffect } from 'react' ;
3+ import { useState , useEffect , useCallback } from 'react' ;
44import { useShowPopup } from '@vkruglikov/react-telegram-web-app' ;
55import { useRouter } from 'next/navigation' ;
66import { pluginsApi , Plugin } from '@/utils/api' ;
@@ -48,7 +48,7 @@ export default function PluginsStore() {
4848 const [ loading , setLoading ] = useState ( true ) ;
4949 const [ error , setError ] = useState < string | null > ( null ) ;
5050
51- const loadPlugins = async ( ) => {
51+ const loadPlugins = useCallback ( async ( ) => {
5252 try {
5353 setLoading ( true ) ;
5454 const data = await pluginsApi . listPlugins ( ) ;
@@ -63,11 +63,11 @@ export default function PluginsStore() {
6363 } finally {
6464 setLoading ( false ) ;
6565 }
66- } ;
66+ } , [ showPopup ] ) ;
6767
6868 useEffect ( ( ) => {
6969 loadPlugins ( ) ;
70- } , [ ] ) ;
70+ } , [ loadPlugins ] ) ;
7171
7272 const filteredPlugins = plugins . filter ( plugin =>
7373 plugin . title . toLowerCase ( ) . includes ( searchQuery . toLowerCase ( ) ) ||
You can’t perform that action at this time.
0 commit comments