Skip to content

Add episode summary display and update service worker cache version#6

Merged
OrF8 merged 1 commit intomasterfrom
Adding-Episode-Summary
Mar 25, 2026
Merged

Add episode summary display and update service worker cache version#6
OrF8 merged 1 commit intomasterfrom
Adding-Episode-Summary

Conversation

@OrF8
Copy link
Copy Markdown
Owner

@OrF8 OrF8 commented Mar 25, 2026

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:

  • Added a new <p id="summary" class="episode-summary"> element to index.html to display episode summaries.
  • Created a getEpisodeDetails function in script.js to fetch both the episode image and summary, and added a stripHtml utility to clean up summary text.
  • Updated renderSample in script.js to show "Loading summary..." while fetching, display the summary when available, and handle errors by showing an appropriate message. [1] [2] [3]
  • Added CSS styling for .episode-summary in style.css for improved appearance.

Offline Support:

  • Incremented the service worker cache version to ensure users receive the latest assets and summary feature updates.

@OrF8 OrF8 self-assigned this Mar 25, 2026
@OrF8 OrF8 added the enhancement New feature or request label Mar 25, 2026
Copilot AI review requested due to automatic review settings March 25, 2026 11:04
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +1 to 4
const CACHE_NAME = "seinfeld-randomizer-v2";
const URLS_TO_CACHE = [
"./",
"./index.html",
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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))).

Copilot uses AI. Check for mistakes.
Comment on lines +367 to +368
const summaryEl = document.getElementById("summary");

Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

Repository owner deleted a comment from Copilot AI Mar 25, 2026
@OrF8 OrF8 merged commit 8ca4acf into master Mar 25, 2026
7 checks passed
@OrF8 OrF8 deleted the Adding-Episode-Summary branch March 25, 2026 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants