Editor shows [object Object] instead of text
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 201
- Avg merge
- 12m
- Merged PRs (30d)
- 1
Description
Hi,
I am using this markdown editor and generally, it works amazingly (thanks :) )
However there is a strange issue with it:
At the first rendering, the editor side renders strange symbols in the form of [object Object] instead of the actual text:

The bad symbols are not selectable, instead when trying to copy them, the correct text is displayed. Also changing something in the editor immediately fixes the problem.
This is how the element looks like in dev tools:

And here is the react component I am using to render it:
import loadable from '@loadable/component';
const MDEditor = loadable(() => import('@uiw/react-md-editor'))
import { useState } from "react"
import { Link, useNavigate, useParams } from "react-router-dom"
import { useAddImageMutation, useAddProjectTagMutation, useDeleteProjectMutation, useGetProjectByIdQuery, useRemoveImageMutation, useRemoveProjectTagMutation, useUpdateImageDescriptionMutation, useUpdateProjectDescriptionMutation, useUpdateProjectNameMutation } from "../schemas"
import Button from "../shared/Button"
import Input from "../shared/Input"
import "./projectEditor.css"
import useConfig from "../config";
import TagSelector from '../shared/tagSelector/TagSelector';
export const ProjectEditor: React.FC = props => {
const params = useParams()
const projectId = params["id"]
const config = useConfig()
const [description, setDescription] = useState<string | null>(localStorage.getItem("description#" + projectId))
const projectData = useGetProjectByIdQuery({
variables: { id: projectId || "" }, onCompleted: (data) => {
setDescription(data?.getProject?.description || "")
}
})
...
const [updateProjectDescription] = useUpdateProjectDescriptionMutation()
if (!projectId) {
return <Link to="/">Invalid URL! Go home</Link>
}
if (!projectData.data?.getProject) {
return <Link to="/">Invalid Project ID! Go home</Link>
}
return (
<div className="project-editor">
<h1>Edit project "{projectData.data?.getProject?.name}"</h1>
...
{description !== null && <div className="project-editor-component">
<h2>Description</h2>
<MDEditor value={description} preview={config.view == "mobile" ? "edit" : undefined}
onChange={(newDescription) => {
setDescription(newDescription || null)
}}
/>
<Button onClick={() => {
const newDescription = description || ""
setDescription(null)
updateProjectDescription({ variables: { newDescription, projectId: projectId } })
.then((res) => {
if (res.data?.projectMutation?.updateDescription) {
projectData.refetch().then(() => {
setDescription(newDescription)
})
} else {
alert(res.errors?.join(""))
setDescription(newDescription)
}
}).catch((r) => {
alert("Could not update description")
setDescription(newDescription)
})
}}>Save</Button>
</div>}
...
</div>
)
}
Interestingly this issue only occurs in the bundle and not in the dev mode (vitejs) which makes it hard to debug.
Am I doing something wrong or is this an actual bug?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the provided ProjectEditor and MDEditor usage, comparing the production bundle with Vite dev mode. Inspect the initial rendering path and confirm that the editor displays the actual markdown text rather than [object Object] before any edit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript, vite
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100