Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
Make markdown error messages platform-aware (#5773)
Peter Chinmana2cf21ca09e8
diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/constants.ts b/apps/web/src/lib/core/component/LexicalMarkdown/constants.tsindex b5690ae003..8842631a0e 100644--- a/apps/web/src/lib/core/component/LexicalMarkdown/constants.ts+++ b/apps/web/src/lib/core/component/LexicalMarkdown/constants.ts@@ -1,3 +1,5 @@+import { isNativeMobilePlatform } from '@core/mobile/isNativeMobilePlatform';+let layer = 0;export const MarkdownStackingContext = {@@ -14,18 +16,26 @@ export enum MarkdownEditorErrors {STAGING_VERSION_MISMATCH_ERROR = 'STAGING_VERSION_MISMATCH_ERROR',}-const MarkdownEditorErrorDescriptions: Record<MarkdownEditorErrors, string> = {- [MarkdownEditorErrors.EMPTY_SOURCE]: 'No document content could be found.',- [MarkdownEditorErrors.JSON_PARSE_ERROR]:+const MarkdownEditorErrorDescriptions: Record<+ MarkdownEditorErrors,+ () => string+> = {+ [MarkdownEditorErrors.EMPTY_SOURCE]: () =>+ 'No document content could be found.',+ [MarkdownEditorErrors.JSON_PARSE_ERROR]: () =>'Parse error. Invalid document JSON.',- [MarkdownEditorErrors.VERSION_MISMATCH_ERROR]:- 'Refresh the page to edit this document. It may have been updated using a newer version of Macro.',- [MarkdownEditorErrors.STAGING_VERSION_MISMATCH_ERROR]:+ // The native mobile app has no way to refresh a page, so tell those users to+ // relaunch the app instead.+ [MarkdownEditorErrors.VERSION_MISMATCH_ERROR]: () =>+ isNativeMobilePlatform()+ ? 'Close and re-open the app to edit this document. It may have been updated using a newer version of Macro.'+ : 'Refresh the page to edit this document. It may have been updated using a newer version of Macro.',+ [MarkdownEditorErrors.STAGING_VERSION_MISMATCH_ERROR]: () =>'This doc has been updated on an incompatible version of staging. If you are seeing this message, please open the document on staging to edit.',};export const getErrorDescription = (errorType: MarkdownEditorErrors): string => {- return MarkdownEditorErrorDescriptions[errorType];+ return MarkdownEditorErrorDescriptions[errorType]();};