## Bug description

*Please describe.*  
*If this affects the front-end, screenshots would be of great help.*  

Trailing spaces in the selector box are not removed automatically and can mess up the event results when saving an action

## Expected behavior



## How to reproduce

1. Create a new action with any selector
2. put in a couple of spaces at the end of the line in the selector input box
3. 

## Environment

- Self-managed?
- PostHog version/commit

## Additional context



#### *Thank you* for your bug report – we love squashing them!

posthog/models/event.py
]
        actions = (
            Action.objects.filter(
                team_id=self.team_id, steps__event=self.event, deleted=False,  
            )
            .distinct("id")
            .prefetch_related(Prefetch("steps", queryset=ActionStep.objects.order_by("id")))
        )
        if not self._can_use_cached_query(last_updated_action_ts):
            TEAM_ACTION_QUERY_CACHE[self.team_id], _ = actions.query.sql_with_params()
            if len(actions) == 0:
                return []
            events: models.QuerySet[Any] = Event.objects.filter(pk=self.pk)
            for action in actions:
                events = events.annotate(
                    **{
                        "action_{}".format(action.pk): Event.objects.filter(pk=self.pk)
                        .query_db_by_action(action)
                        .values("id")[:1]
                    }
                )
            
            
            q, p = events.query.sql_with_params()
            
            
            
            qp = tuple(["%s" if i == self.pk else i for i in p])
            
            qcache = {self.event: (q, qp)}