Roguelike-Celebration / azure-mud

MIT License
185 stars 30 forks source link

Content authoring system should have a way to create React components #346

Open brittag opened 3 years ago

brittag commented 3 years ago

Same refresh bug that affected the theater.

For me, clicking play on the second Soundcloud embed caused a refresh issue, but the first one didn't cause it.

lazerwalker commented 3 years ago

The underlying issue with both the theater video stream and the dance floor SoundCloud embeds is that, instead of raw HTML elements that got refreshed on re-render, we needed React ref tags attached to the media elements.

The short-term fix we did during the event: I hardcoded in that the theater should be a ref.

The medium-term fix: The way we create roomData should give authors a way to specify "this should be a ref'd iframe with this URL and options"

The long-term proper fix with other long-term benefits: Authors should be able to send strings that get parsed as React components instead of just HTML. I did some work trying to parse this safely, but there were bugs in the underlying library I was using (which I sadly can't remember — a branch may exist).

lazerwalker commented 3 years ago

Currently looking at https://github.com/TroyAlford/react-jsx-parser.

An issue we will have with this library (that we also had with the previous attempt) is an (intentional) lack of support for onClick handlers, and needing a sensible way to manually handle or avoid having one-off click events.

lazerwalker commented 3 years ago

This is going to be a pain, but is going to greatly improve our ability to create compelling content without risk of bugs.

lazerwalker commented 2 years ago

This would potentially open up a bunch of content options in 2022. The million-dollar question is if the React community has given a prefab answer to this in the last two years.