Add month view for bazaar and validate range parameter#1487
Merged
Conversation
- Add DateRange.MONTH to bazaar's dateRangesToDisplay - Handle month range in loadBazaarPrices using getBazaarPricesByRange with start/end dates - Handle month range in server-side fetchPrices for bazaar items - Validate URL range parameter against valid DateRange values in all components - Invalid range parameters now default to the default range instead of breaking Agent-Logs-Url: https://github.com/Coflnet/hypixel-react/sessions/29e88e89-178b-472f-88a8-04d2821714e7 Co-authored-by: Ekwav <[email protected]>
Copilot
AI
changed the title
[WIP] Add month view to bazaar auctions
Add month view for bazaar and validate range parameter
Apr 1, 2026
matthias-luger
requested changes
Apr 3, 2026
| let router = useRouter() | ||
| let searchParams = useSearchParams() | ||
| let [selectedDateRange, _setSelectedDateRange] = useState(searchParams.get('range') || DEFAULT_DATE_RANGE) | ||
| let validRanges = Object.values(DateRange) as string[] |
Collaborator
There was a problem hiding this comment.
As this is a contant value, i would move this outside the component to the top of the page
Comment on lines
+42
to
+43
| let urlRange = searchParams.get('range') | ||
| let [selectedDateRange, _setSelectedDateRange] = useState(urlRange && validRanges.includes(urlRange) ? urlRange : DEFAULT_DATE_RANGE) |
Collaborator
There was a problem hiding this comment.
i would write the default-parameter here as a function so you can move the "urlRange" inside an dit only runs once
Comment on lines
+85
to
+87
| let validRanges = Object.values(DateRange) as string[] | ||
| let urlRange = searchParams.get('range') | ||
| let [fetchspan, setFetchspan] = useState(urlRange && validRanges.includes(urlRange) ? (urlRange as DateRange) : DEFAULT_DATE_RANGE) |
Collaborator
There was a problem hiding this comment.
same as above and as you use it multiple times, i would move it into its own hook "useValidRanges" for example
Comment on lines
+95
to
+97
| let urlRange = getURLSearchParam('range') | ||
| let validRanges = Object.values(DateRange) as string[] | ||
| fetchspan = (urlRange && validRanges.includes(urlRange) ? (urlRange as DateRange) : DEFAULT_DATE_RANGE) |
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.
Bazaar has no
/history/monthendpoint, so?range=month(valid for auctions) breaks bazaar items. Additionally, arbitrary invalidrangevalues were passed through unchecked.Bazaar month support
DateRange.MONTHto bazaar'sdateRangesToDisplayso the button rendersloadBazaarPrices) and server (fetchPrices) by usinggetBazaarPricesByRangewith start/end dates, same pattern already used for "All Time":Range parameter validation
getItemData): validate against known range values, default to'day'ItemPriceRange,BazaarPriceGraph,AuctionHousePriceGraph): validate URL range before using it as initial state — invalid values fall through toDEFAULT_DATE_RANGEwithout triggering URL updates, avoiding redirect loopsWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
download.cypress.io/home/REDACTED/work/_temp/ghcca-node/node/bin/node node index.js --exec install(dns block)If you need me to access, download, or install something from one of these locations, you can either: