-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
chore(ai): prefetch the markdown text to get around ios security blocking async call on gesture #14354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Bundle ReportChanges will increase total bundle size by 256 bytes (0.0%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: sentry-docs-client-array-pushAssets Changed:
view changes for bundle: sentry-docs-server-cjsAssets Changed:
Files in
|
bf8b078 to
b546c8c
Compare
codyde
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Prefetching Hook Fails to Update Content
The prefetching useEffect fails to update content when the pathname changes. Because prefetchedContent retains the old page's data, the if (!prefetchedContent) condition prevents fetching new content. This results in the copy button providing stale markdown from the previous page.
src/components/copyMarkdownButton.tsx#L97-L110
sentry-docs/src/components/copyMarkdownButton.tsx
Lines 97 to 110 in 839c333
| // fetch on tap because the user gesture is lost by the time we try to update the clipboard. | |
| useEffect(() => { | |
| if (!prefetchedContent) { | |
| const prefetchContent = async () => { | |
| try { | |
| const content = await fetchMarkdownContent(); | |
| setPrefetchedContent(content); | |
| } catch (err) { | |
| // Silently fail - we'll fall back to regular fetch on click | |
| } | |
| }; | |
| prefetchContent(); | |
| } | |
| }, [pathname, prefetchedContent, fetchMarkdownContent]); |
Was this report helpful? Give feedback by reacting with 👍 or 👎
…king async call on gesture (#14354)
No description provided.