fix: resolve onboarding welcome template empty content bug (BUG-ONBOARD-001)#140
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Overview
This PR resolves the critical onboarding bug BUG-ONBOARD-001, where first-time users see a blank editor and preview panel despite the "Welcome to Markdown" tab being successfully created.
Root Cause Analysis
index.htmlusing a stale-while-revalidate strategy. If a user receives the cached version ofindex.htmlfrom a previous release (which defines the template as<template id="default-markdown">) but loads the newscript.js(which expects<script type="text/markdown" id="default-markdown">and accesses itstextContent), the resulting retrieval evaluates to""since a<template>tag's contents reside inside its.contentdocument fragment.textContentbranch. Evaluating"".trim()yielded an empty string""and completely bypassed the hardcoded welcome markdown fallback.Remediation Details
script.jsto dynamically inspect the template element. It now safely extracts text content from both modern<script type="text/markdown">and older cached<template>tags.||) condition. This guarantees that if retrieved text is empty or missing, the application automatically falls back to the hardcoded welcome markdown string rather than hydrating an empty editor.node prepare.js) to sync thescript.jschanges todesktop-app/resources/js/script.jsand update the offline-firstresources/index.html.Verification & Testing
<script>tag: PASS (retrieved full welcome markdown)<template>tag: PASS (retrieved full welcome markdown)localStoragethat the editor and preview hydrate perfectly. Existing saved tabs continue to load exactly as before.