Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b8fdd3f56a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| function isAtInputLimit() { | ||
| return estimateUrlSizeFromBlocks(blocks) >= URL_THRESHOLDS.danger | ||
| const size = (urlMetrics.version === contentVersion) | ||
| ? urlMetrics.size | ||
| : new Blob([location.href]).size | ||
| return size >= URL_THRESHOLDS.danger |
There was a problem hiding this comment.
Use live content size for input limit enforcement
The new isAtInputLimit checks only urlMetrics (when versions match) or location.href (when they don’t). During active typing/pasting, the URL hash hasn’t been updated yet, so location.href reflects the previous saved state and urlMetrics is stale until the debounced recomputation finishes. This means the limit checks in handleBeforeInput/handlePaste can allow users to type or paste well past the URL threshold before the limit flips, which defeats the size guard that previously used a live estimate from blocks. Consider reverting to (or incorporating) estimateUrlSizeFromBlocks for enforcement so the limit is based on the current content, not the last saved URL.
Useful? React with 👍 / 👎.
Motivation
location.hrefduring edits.file://origins wherelocation.origin === 'null'.Description
contentVersionandurlMetricsplus helpersbuildShareUrl,refreshUrlMetrics,syncUrlMetricsToLocation, andscheduleUrlMetricsUpdateto compute and cache the share URL and its byte size.updateStatusBar,updateQR, tooltip logic, andisAtInputLimitto useurlMetricswhenurlMetrics.version === contentVersion.contentVersioninscheduleSaveand other lifecycle points and updatedsave()to compute and storeurlMetricsafter saving, so share/QR/clipboard reflect the latest saved URL.decompressToBlocksresilient by attempting decoding in both base85 and base64 orders (depending on detection), retrying the other format on failure, and preserving encrypted errors (err.type === 'ENCRYPTED') so they propagate unchanged.file:///local origins by preserving the local base path instead of returning an invalidnullorigin, usingnormalizeHashand an encoded hash suffix.debounceutility and wiredscheduleUrlMetricsUpdate(350ms) to avoid expensive recomputation during typing, and synced metrics to location changes in theme/version/preview/encryption flows.Testing
python -m http.server) and running a Playwright script to type and inspect the UI, but the Playwright run timed out after 30s and did not complete (failure); no further automated tests were present.Codex Task