@@ -115,12 +115,46 @@ def get_minify_config() -> MinifyConfig | None:
115115
116116
117117def is_minify_enabled () -> bool :
118- """Check if minification is enabled.
118+ """Check if any minification is enabled (state or event) .
119119
120120 Returns:
121- True if minify.json exists and is valid .
121+ True if either state or event minification is enabled .
122122 """
123- return get_minify_config () is not None
123+ return is_state_minify_enabled () or is_event_minify_enabled ()
124+
125+
126+ @functools .cache
127+ def is_state_minify_enabled () -> bool :
128+ """Check if state ID minification is enabled.
129+
130+ Requires both REFLEX_MINIFY_STATE=enabled and minify.json to exist.
131+
132+ Returns:
133+ True if state minification is enabled.
134+ """
135+ from reflex .environment import MinifyMode , environment
136+
137+ return (
138+ environment .REFLEX_MINIFY_STATE .get () == MinifyMode .ENABLED
139+ and get_minify_config () is not None
140+ )
141+
142+
143+ @functools .cache
144+ def is_event_minify_enabled () -> bool :
145+ """Check if event ID minification is enabled.
146+
147+ Requires both REFLEX_MINIFY_EVENTS=enabled and minify.json to exist.
148+
149+ Returns:
150+ True if event minification is enabled.
151+ """
152+ from reflex .environment import MinifyMode , environment
153+
154+ return (
155+ environment .REFLEX_MINIFY_EVENTS .get () == MinifyMode .ENABLED
156+ and get_minify_config () is not None
157+ )
124158
125159
126160def get_state_id (state_full_path : str ) -> str | None :
@@ -175,6 +209,8 @@ def clear_config_cache() -> None:
175209 This should be called after modifying minify.json programmatically.
176210 """
177211 get_minify_config .cache_clear ()
212+ is_state_minify_enabled .cache_clear ()
213+ is_event_minify_enabled .cache_clear ()
178214
179215
180216# Base-54 encoding for minified names
0 commit comments