fix(OpeningHours): stabilize component — lat/lon, caching, errors, types, isEvent#840
Open
wazolab wants to merge 4 commits into
Open
fix(OpeningHours): stabilize component — lat/lon, caching, errors, types, isEvent#840wazolab wants to merge 4 commits into
wazolab wants to merge 4 commits into
Conversation
GeoJSON coordinates are [lon, lat]. The bbox_line indices were inverted, causing wrong timezone/sunrise calculations (root cause of #353).
Replace five separate OpeningHoursFactory() calls with a single `oh` computed, so the opening hours string is parsed only once per render.
Replace silent catch blocks with console.warn guarded by import.meta.dev so invalid opening_hours strings are surfaced during development without impacting users in production.
- optional_conf: provide all fields explicitly with undefined so the object satisfies the interface without casting - prettifyValue: augment argument_hash in declarations.d.ts with a conf field matching the actual runtime API, removing the need for any cast
952cf97 to
ae5a346
Compare
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.
Closes #753
Summary
Six atomic commits, each independently reviewable:
[lon, lat]; the indices were inverted, causing wrong timezone/sunrise calculations (root cause of Wrong color on opening hours #353).OpeningHoursFactory()calls with oneohcomputed; the string is now parsed once per render.catch (e) {}blocks withconsole.warn('[OpeningHours] …')guarded byimport.meta.dev.@ts-expect-errorsuppressions —optional_confis now built with all fields explicit (satisfies optional_conf);prettifyValueis cast viaParameters<>to acknowledge the undocumentedconfwrapper.isEventcomputed detects year-prefixed strings (/^\d{4}\s/). When true the template renders a flat date summary and suppresses thevariableWeekwarning. Closes Display agenda schedule instead of shop opening hours #467.tagKey→renderKey, configuresettingsinbeforeEach, add tests for lat/lon, console.warn spy,isEvent,comment,variable, edge cases (24/7,off, empty, invalid).Verification
yarn nuxi typecheck .— passes, no@ts-expect-errorremainingtagKey→renderKeycorrected in factory)