Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code blocks lead to redefined const in web page #4575

Open
sebastianjanisch opened this issue Dec 28, 2024 · 2 comments
Open

Code blocks lead to redefined const in web page #4575

sebastianjanisch opened this issue Dec 28, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@sebastianjanisch
Copy link

Describe the bug
When using two different code blocks with different languages the produced web page produces an error with a redefined const.

To Reproduce

import reflex as rx


def test_page() -> rx.Component:
    return rx.vstack(
        rx.code_block(
            "{}",
            language="json",
            show_line_numbers=True,
        ),
        rx.code_block(
            "print(abc)",
            language="python",
            show_line_numbers=True,
        ),
    )

Expected behavior
Page should work

Screenshots

export function Fragment_ba4570fd3640bc8a8c5632b9f9459180 () {
  const reflex___state____state = useContext(StateContexts.reflex___state____state)
  const { resolvedColorMode } = useContext(ColorModeContext)


  const _language = "json"
  
 if (_language) {
    (async () => {
      try {
        const module = await import(`react-syntax-highlighter/dist/cjs/languages/prism/${_language}`);
        SyntaxHighlighter.registerLanguage(_language, module.default);
      } catch (error) {
        console.error(`Error importing language module for ${_language}:`, error);
      }
    })();
  }

  const _language = "python"

  return (
    <Fragment>

Specifics (please complete the following information):

  • Python Version: 3.11
  • Reflex Version: 0.6.6
  • OS: osx
  • Browser (Optional): chrome

Additional context
Add any other context about the problem here.

Copy link

linear bot commented Dec 28, 2024

@Lendemor Lendemor added the bug Something isn't working label Dec 29, 2024
@adhami3310
Copy link
Member

@ElijahAhianyo do you know what should be done here? :o

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants