Enhancement : Added API caching, loading states, and real-time search … - #1
Open
codeCraft-Ritik wants to merge 1 commit into
Open
Enhancement : Added API caching, loading states, and real-time search …#1codeCraft-Ritik wants to merge 1 commit into
codeCraft-Ritik wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Code Updates
The following improvements were made to transition the project from a basic static site to a more professional, performance-oriented web application:
localStoragelogic inprice1.htmlto cache cryptocurrency data for 60 seconds. This prevents the "429 Too Many Requests" error commonly encountered with the CoinGecko free API during frequent refreshes..then()promise chains to modernasync/awaitsyntax for better readability and error management.js/price.jsthat monitors the search input and dynamically hides or shows table rows based on the coin's name or symbol.Enhanced User Experience (UX):
Data Formatting & Cleanliness:
Updated the currency display using
.toLocaleString()to show professional formatting (e.g., $ 50,000.00 instead of 50000).Consolidated color-coding logic to highlight positive and negative 24h changes.
Code Maintainability: Cleaned up selectors and added safety checks (e.g.,
if (slider)) to prevent JavaScript errors across different pages.