fix: migrate to Reflex 0.9 and pin suneditor 2.x#5
Open
JiaLiangChen99 wants to merge 1 commit into
Open
Conversation
- Migrate EditorOptions from Base to PropsBase (Reflex 0.9 breaking change) - Pin suneditor to 2.47.10 to satisfy suneditor-react@3.6.1 peer dependency - Update add_imports() return format for Reflex 0.8+/0.9 frontend build - Bump minimum Reflex version to >=0.9.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrate the SunEditor component to Reflex 0.9+ and fix npm dependency resolution issues that cause runtime module load failures.
Background
Reflex 0.9 breaking change
Reflex 0.9 removed
rx.Base(Pydantic V1). Component option/config classes must now subclassrx.PropsBaseinstead.class EditorOptions(Base)withfrom reflex.base import Baseclass EditorOptions(PropsBase)withfrom reflex import PropsBaseMigration guide: https://reflex.dev/blog/upgrading-reflex-0-8-to-0-9/
SunEditor version pin
Editor.libraryissuneditor-react@3.6.1, which requiressuneditor@^2.44as a peer dependency.Previously,
lib_dependencies = ["suneditor"]did not pin a version, so npm could resolvesuneditor@3.x(latest major). This is incompatible withsuneditor-react@3.6.1and causes module load failures at runtime.Fix: pin to
suneditor@2.47.10(latest 2.x satisfying^2.44).CSS import format
Updated
add_imports()to return a list ofImportVarinstead of a singleImportVar, which is required by newer Reflex frontend builds.Changes
reflex_suneditor/editor.pyEditorOptions:Base→PropsBasereflex_suneditor/editor.pylib_dependenciestosuneditor@2.47.10reflex_suneditor/editor.pyadd_imports()returns list formatreflex_suneditor/editor.pyset_options.dict()directly (PropsBase handles camelCase)pyproject.tomlreflex>=0.9.0,<1.0uv.lockBreaking change
This drops support for Reflex
<0.9.0. Users on Reflex 0.7/0.8 should continue usingreflex-suneditor==0.1.0.post1.Test plan
on_changecallback fires when typing