Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kmcgrady
Copy link
Collaborator

Describe your changes

There are issues with react-syntax-highlighter as an ESM module with Vite. As a result, we explicitly choose the common js format in order to fix the issue.

The steps here react-syntax-highlighter/react-syntax-highlighter#565 help illustrate the issue

GitHub Issue Link (if applicable)

closes #10231

Testing Plan

  • Automated testing should still test everything works properly
  • Manual testing to attempt to reproduce the issue.

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@kmcgrady kmcgrady added security-assessment-completed Security assessment has been completed for PR change:bugfix PR contains bug fix implementation impact:users PR changes affect end users labels Jan 24, 2025

.PHONY: frontend-fast
frontend-fast:
cd frontend/ ; yarn workspace @streamlit/app buildFast
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This no longer exists, so I updated it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we even still need frontend-fast? Is it faster compared to make frontend?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eh. make frontend builds everything. make frontend-build-with-profiler is fast with profiler. There is make frontend-app, but it does not copy over the files.

I used it in testing cause it was the easiest way for me to build the app frontend and copy it over with no profiling. There's probably opportunities to clean it up. Perhaps when we talk about cleaning up the makefile.

Copy link
Collaborator

@raethlein raethlein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix seems to work for me 👍 ✅
Great work!
I was able to constantly reproduce the issue when opening the Streamlit app with a production build in a new tab, then go to a different tab, right-click on the original Streamlit tab and click 'Reload', go back to the Streamlit tab and see that the code block is rendered in the wrong way.
Now, I don't seem to be able to reproduce it with the fix.

@kmcgrady kmcgrady merged commit 99bcf16 into develop Jan 24, 2025
44 checks passed
@kmcgrady kmcgrady deleted the fix/st-code branch March 10, 2025 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:bugfix PR contains bug fix implementation impact:users PR changes affect end users security-assessment-completed Security assessment has been completed for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

st.code is not displayed correctly if the code block is not in the viewport when the page loads

4 participants