bugfixing: scroll freeze

This commit is contained in:
MuslemRahimi 2024-10-11 22:36:30 +02:00
parent 124b1717e2
commit 62d3f6a021

View File

@ -284,11 +284,9 @@ async function handleDeleteTickers() {
} }
async function handleAddTicker(event, ticker) { async function handleAddTicker(event, ticker) {
event.preventDefault();
// Ensure inputValue is reset // Ensure inputValue is reset
inputValue = '';
// Check if the ticker is already in the watchList; if not, add it
if (!watchList?.some(item => item?.symbol === ticker)) { if (!watchList?.some(item => item?.symbol === ticker)) {
} else { } else {
toast.error(`This symbol is already in your watchlist`, { toast.error(`This symbol is already in your watchlist`, {
@ -329,6 +327,10 @@ if (!watchList?.some(item => item?.symbol === ticker)) {
// Fetch the updated watchlist data (assuming this function refreshes the UI or state) // Fetch the updated watchlist data (assuming this function refreshes the UI or state)
await getWatchlistData(); await getWatchlistData();
inputValue = '';
event?.preventDefault();
} }
@ -642,7 +644,7 @@ function search() {
class="cursor-pointer text-white border-b border-gray-600 last:border-none flex h-fit w-auto select-none items-center rounded-button py-3 pl-5 pr-1.5 text-sm capitalize outline-none transition-all duration-75 data-[highlighted]:bg-[#27272A]" class="cursor-pointer text-white border-b border-gray-600 last:border-none flex h-fit w-auto select-none items-center rounded-button py-3 pl-5 pr-1.5 text-sm capitalize outline-none transition-all duration-75 data-[highlighted]:bg-[#27272A]"
value={item.symbol} value={item.symbol}
label={item.name} label={item.name}
on:click={() => handleAddTicker(event, item?.symbol)} on:click={(e) => handleAddTicker(e,item?.symbol)}
> >
<div class="flex flex-col items-start"> <div class="flex flex-col items-start">
<span class="text-sm text-blue-400">{item?.symbol}</span> <span class="text-sm text-blue-400">{item?.symbol}</span>
@ -650,7 +652,7 @@ function search() {
</div> </div>
</Combobox.Item> </Combobox.Item>
{:else} {:else}
<span class="block px-5 py-2 text-sm text-muted-foreground"> <span class="block px-5 py-2 text-sm text-white">
No results found No results found
</span> </span>
{/each} {/each}