fix(perception): replace string matching with structural feed marker check for perfect snapping

This commit is contained in:
2026-05-03 16:31:32 +02:00
parent 6cd068f951
commit 800fb1da98

View File

@@ -29,9 +29,11 @@ class PerfectSnappingPlugin(BehaviorPlugin):
if not getattr(self, "_enabled", True):
return False
xml_lower = ctx.context_xml.lower()
# Do not snap if we are on a profile page or grid, it's meant for posts.
if "profile_tabs_container" in xml_lower or "explore_grid" in xml_lower:
# Perfect snapping is only for feed posts.
# Do not snap if we are on a profile page, explore grid, or modal.
from GramAddict.core.perception.feed_analysis import has_feed_markers
if not has_feed_markers(ctx.context_xml):
return False
return True