Add episode summary display and update service worker cache version#6
Add episode summary display and update service worker cache version#6
Conversation
There was a problem hiding this comment.
Pull request overview
Adds episode summaries to the Seinfeld random episode app UI by fetching and rendering the episode summary from TVMaze, plus bumps the service worker cache version for offline updates.
Changes:
- Add a summary
<p id="summary">to the episode metadata section and style it via.episode-summary. - Replace image-only fetch with
getEpisodeDetails()to fetch both image URL and summary (with HTML stripping). - Update service worker cache name to a new version.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
index.html |
Adds a dedicated summary element in the episode metadata block. |
script.js |
Fetches/parses episode summaries and updates render flow to show loading/error states. |
style.css |
Styles the new summary text block. |
service-worker.js |
Increments cache version string for offline asset refresh. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const CACHE_NAME = "seinfeld-randomizer-v2"; | ||
| const URLS_TO_CACHE = [ | ||
| "./", | ||
| "./index.html", |
There was a problem hiding this comment.
caches.match(event.request) searches across all caches, so bumping CACHE_NAME alone may not guarantee clients get updated assets (an older cache can still satisfy the request). Add an activate handler to delete old cache names and/or change the fetch handler to match within CACHE_NAME specifically (e.g., caches.open(CACHE_NAME).then(cache => cache.match(req))).
| const summaryEl = document.getElementById("summary"); | ||
|
|
There was a problem hiding this comment.
summaryEl is initialized at the bottom of the file, separated from the other DOM element lookups at the top. For readability and to avoid future ordering issues, consider moving this getElementById alongside the other const ...El = document.getElementById(...) declarations near the start.
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
This pull request adds episode summaries to the Seinfeld random episode app and improves the user experience by displaying a summary for each episode, handling errors gracefully, and updating the cache version for offline support. The most important changes are grouped below:
Episode Summary Feature:
<p id="summary" class="episode-summary">element toindex.htmlto display episode summaries.getEpisodeDetailsfunction inscript.jsto fetch both the episode image and summary, and added astripHtmlutility to clean up summary text.renderSampleinscript.jsto show "Loading summary..." while fetching, display the summary when available, and handle errors by showing an appropriate message. [1] [2] [3].episode-summaryinstyle.cssfor improved appearance.Offline Support: