Static build outputs `[object Object],[object Object],[object Object]` if value prop is set initially
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- react, typescript
- Área
- frontend
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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:

- Lenguaje dominante
- TypeScript
- Estrellas
- 575
- Forks
- 23
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de uiwjs/react-textarea-code-editor
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 20/100
uiwjs/react-textarea-code-editor#186 · 2 reacciones ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 42/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 30/100
uiwjs/react-textarea-code-editor#183 · 1 comentario · 2 reacciones ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 42/100
uiwjs/react-textarea-code-editor#182 · 3 reacciones ·
-
fail to show line number Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 38/100
uiwjs/react-textarea-code-editor#181 · 4 comentarios · 12 reacciones ·
Todos los issues de uiwjs/react-textarea-code-editor
Issues similares
-
blocklist removal
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
MetaMask/eth-phishing-detect#296544 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
pastelsky/bundlephobia#1122 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
category/development priority/P2 scope/file-operations scope/testing type/enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100