fix(tldraw): allow TldrawSelectionForeground without TldrawUiContextProvider#8011
Merged
mimecuvalo merged 1 commit intomainfrom Feb 25, 2026
Merged
fix(tldraw): allow TldrawSelectionForeground without TldrawUiContextProvider#8011mimecuvalo merged 1 commit intomainfrom
mimecuvalo merged 1 commit intomainfrom
Conversation
…rovider Make useTranslation() gracefully fall back to default English translations when TranslationsContext is not available, instead of throwing. This allows TldrawSelectionForeground (and its child components) to be used with TldrawEditor directly, without requiring TldrawUiContextProvider. Closes #6236
|
The latest updates on your projects. Learn more about Vercel for GitHub.
5 Skipped Deployments
|
steveruizok
approved these changes
Feb 24, 2026
steveruizok
added a commit
that referenced
this pull request
Feb 27, 2026
Add 12 new entries from PRs merged since v4.4.0: - Featured: click-through on transparent image pixels (#7942) - API: enum-to-const-object refactor (#8084) - Improvements: SVG sanitizer (#7896), save-on-blur (#8037) - Bug fixes: cross-origin download (#8090), zero-size draw (#8067), rich text toolbar cleanup (#8050), zoom threshold (#8040), selection foreground fallback (#8011), sticky note SVG shadow (#7934), arrow frame clamping (#7932), zero pressure draw (#5693)
3 tasks
5 tasks
github-merge-queue bot
pushed a commit
that referenced
this pull request
Mar 5, 2026
followup to #8011 tiny nit feedback from @MitjaBezensek ### Change type - [ ] `bugfix` - [ ] `improvement` - [ ] `feature` - [ ] `api` - [x] `other` <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk: adds a `console.warn` when `useTranslation` cannot find translation messages, which may increase log noise but does not change translation lookup behavior. > > **Overview** > `useTranslation` now emits a `console.warn` when no translation messages are present and it falls back to `DEFAULT_TRANSLATION`, making missing/incorrect translation provider setup more visible during development. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit cd95cda. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
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.
In order to allow SDK users to use
TldrawSelectionForegroundwithTldrawEditordirectly (without wrapping inTldrawUiContextProvider), this PR makesuseTranslation()gracefully fall back to default English translations whenTranslationsContextis not available.Closes #6236
PR #7053 partially addressed this for
NoteShapeUtilbut missedTldrawSelectionForegroundand its child components (RotateCornerHandle,MobileRotateHandle,TldrawCropHandles), which all calluseTranslation(). Rather than patching each component individually, this fixesuseTranslation()itself so all current and future consumers are covered.Change type
bugfixTest plan
TldrawEditorwithcomponents={{ SelectionForeground: TldrawSelectionForeground }}but withoutTldrawUiContextProviderRelease notes
TldrawSelectionForegroundcrashing when used withoutTldrawUiContextProviderNote
Low Risk
Small, localized change to a hook to avoid throwing when context is missing, plus a targeted regression test; minimal behavioral impact beyond preventing crashes.
Overview
Fixes a crash when rendering
TldrawSelectionForeground(and other UI pieces callinguseTranslation) withoutTldrawUiContextProviderby makinguseTranslation()fall back toDEFAULT_TRANSLATIONwhenTranslationsContextis absent.Adds a unit test that mounts
TldrawEditorwithSelectionForeground: TldrawSelectionForegroundand asserts selecting a shape renders the selection foreground without triggering the error boundary.Written by Cursor Bugbot for commit 95d5ef8. This will update automatically on new commits. Configure here.