## 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
elif entity.type == TREND_FILTER_TYPE_ACTIONS:
            events = Event.objects.filter(action__pk=entity.id).add_person_id(team.id)
        filtered_events = events.filter(filters.date_filter_Q).filter(filters.properties_to_Q(team_id=team.pk))
        first_date = (
            filtered_events.annotate(first_date=TruncDay("timestamp")).values("first_date", "person_id").distinct()
        )
        events_query, events_query_params = filtered_events.query.sql_with_params()
        first_date_query, first_date_params = first_date.query.sql_with_params()
        full_query = """
            SELECT
                DATE_PART('days', first_date - %s) AS first_date,
                DATE_PART('days', timestamp - first_date) AS date,
                COUNT(DISTINCT "events"."person_id"),
                array_agg(DISTINCT "events"."person_id") as people
            FROM ({events_query}) events
            LEFT JOIN ({first_date_query}) first_event_date
              ON (events.person_id = first_event_date.person_id)
            WHERE timestamp > first_date
            GROUP BY date, first_date
        """
        full_query = full_query.format(
            events_query=events_query, first_date_query=first_date_query, event_date_query=TruncDay("timestamp"),
        )
        with connection.cursor() as cursor:
            cursor.execute(
                full_query, (filters.date_from,) + events_query_params + first_date_params,
            )
            data = namedtuplefetchall(cursor)
            scores: dict = {}
            for datum in data: