FIX: Optimistically fix topic timeline state issues (PR #14328)

This is my second try at this. The first b246a63a592 raised an issue with the event delegation not working because the topic id changed.

This adds support for delegating events to dynamic keys by passing a function where a static key would normally be needed. This means that each timeline will have its own unique state key and events will only delegate to the proper topic.

GitHub