I am currently rendering a view manually like so:
$content = \Drupal::service('renderer')->renderPlain(views_embed_view('user_admin_people', 'page_1'));
renderPlain() rather than
render() because when I was doing that, I was getting this error:
LogicException: Render context is empty, because render() was called outside of a renderRoot() or renderPlain() call. Use renderPlain()/renderRoot() or #lazy_builder/#pre_render instead.
Now, you're probably thinking, why don't you just use render arrays normally and let Drupal handle it? Unfortunately, I can't do that, I need to render the view's html and send it to the page, which I have already done. BUT, when I do this, clicking on 'Filter' brings me to the /admin/people page of the Drupal site (on which it will do ajax filters properly, because it rendered from a normal render array).
Or, where would I look in core to find out more about this, or where is some good documentation to read? Am I looking in the right place in core, looking at ajax_views.js?