Static build outputs `[object Object],[object Object],[object Object]` if value prop is set initially
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- react, typescript
- Ambito
- frontend
Direzione di ricerca
Start with the CodeEditor.tsx reproduction using an initial string value, then compare the live-server output with the statically built HTML shown in the issue. Trace why the generated pre/code content becomes [object Object] during the static build; done when the editor preserves the supplied string value in static output.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Thanks for the awesome and simple to use package. I like it, since it's very simple and it suits my needs perfectly. However, I stumbled upon an issue that I can't seem to get rid of.
If I give CodeEditor an initial value (see code sample below), then when building the project into static files it will display [object Object],[object Object],[object Object] in the editor.
I first thought it had something to do with the state. I initially had a useState and passed the value of that state to the value prop of the editor. But after some inspection, I found that even if the value prop is set to a simple string, it will still render [object Object],[object Object],[object Object] inside the editor.
This only occurs when I build the project into static files. During the development with the live server, this bug does not occur.
Package Version: 1.4.16
Vite version: 2.8.0
Component CodeEditor.tsx:
import { ChangeEvent } from "react";
import { useMantineTheme } from "@mantine/core";
import CodeEditor from '@uiw/react-textarea-code-editor';
import "@uiw/react-textarea-code-editor/dist.css";
type Props = {
query: string | null,
setQuery: (value: string) => void,
};
const Editor = ({ query, setQuery }: Props) => {
const theme = useMantineTheme();
return (
<CodeEditor
value={`SELECT *`}
language="sql"
placeholder="Enter a SQL query."
onChange={(evn: ChangeEvent<HTMLTextAreaElement>) => setQuery(evn.target.value)}
padding={theme.spacing.md}
style={{
height: '100%',
fontSize: theme.fontSizes.lg,
backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[5] : "white",
border: theme.colorScheme === 'dark' ? 'none' : `1px solid ${theme.colors.gray[4]}`,
borderRadius: theme.radius.sm,
resize: 'none',
overflowY: 'auto',
fontFamily:
"ui-monospace,SFMono-Regular,SF Mono,Consolas,Liberation Mono,Menlo,monospace"
}}
/>
);
};
export default Editor
Rendered HTML:
<pre aria-hidden="true" class=" language-sql" tabindex="0">
<code class=" language-sql">
[object Object],[object Object],[object Object]
</code>
<br>
</pre>
Output:

- Lingua principale
- TypeScript
- Stelle
- 575
- Fork
- 23
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di uiwjs/react-textarea-code-editor
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
uiwjs/react-textarea-code-editor#186 · 2 reazioni ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 42/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 30/100
uiwjs/react-textarea-code-editor#183 · 1 commento · 2 reazioni ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 42/100
uiwjs/react-textarea-code-editor#182 · 3 reazioni ·
-
fail to show line number Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 38/100
uiwjs/react-textarea-code-editor#181 · 4 commenti · 12 reazioni ·
Tutte le issue di uiwjs/react-textarea-code-editor
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
mksglu/context-mode#1200 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
jaegertracing/jaeger-ui#4506 ·
-
area:desktop area:ui bug platform:macos
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
anthropics/claude-code#96687 ·
-
good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
AOSSIE-Org/DebateAI#582 · 2 commenti ·