Skip to content

fix: migrate to Reflex 0.9 and pin suneditor 2.x#5

Open
JiaLiangChen99 wants to merge 1 commit into
reflex-dev:mainfrom
JiaLiangChen99:fix/reflex-0.9-compat
Open

fix: migrate to Reflex 0.9 and pin suneditor 2.x#5
JiaLiangChen99 wants to merge 1 commit into
reflex-dev:mainfrom
JiaLiangChen99:fix/reflex-0.9-compat

Conversation

@JiaLiangChen99

Copy link
Copy Markdown

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 subclass rx.PropsBase instead.

  • Before: class EditorOptions(Base) with from reflex.base import Base
  • After: class EditorOptions(PropsBase) with from reflex import PropsBase

Migration guide: https://reflex.dev/blog/upgrading-reflex-0-8-to-0-9/

SunEditor version pin

Editor.library is suneditor-react@3.6.1, which requires suneditor@^2.44 as a peer dependency.

Previously, lib_dependencies = ["suneditor"] did not pin a version, so npm could resolve suneditor@3.x (latest major). This is incompatible with suneditor-react@3.6.1 and 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 of ImportVar instead of a single ImportVar, which is required by newer Reflex frontend builds.

Changes

File Change
reflex_suneditor/editor.py EditorOptions: BasePropsBase
reflex_suneditor/editor.py Pin lib_dependencies to suneditor@2.47.10
reflex_suneditor/editor.py add_imports() returns list format
reflex_suneditor/editor.py Use set_options.dict() directly (PropsBase handles camelCase)
pyproject.toml Bump dependency to reflex>=0.9.0,<1.0
uv.lock Updated lockfile

Breaking change

This drops support for Reflex <0.9.0. Users on Reflex 0.7/0.8 should continue using reflex-suneditor==0.1.0.post1.

Test plan

  • Tested locally with Reflex 0.9.3
  • Editor renders correctly in the browser
  • on_change callback fires when typing

- 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant