Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow a parent session to be explicitly passed to Base.show(...) #254

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

frankier
Copy link
Contributor

I'm opening this PR mainly looking for a way forward with my attempts at allowing others to use the subsession mechanism to include multiple Bonito fragments sharing a single websocket. There is quite a bit of functionality in this package related to this, and its possible my understanding is lacking, so it could be there is a better one.

What I've added here is a parent keyword argument to Base.show(... text/html ...). This is a bit awkward since it will not be passed through the default dispatching so a string "text/html" won't get converted into ::MIME{:text/html}. This could possible to fix just for ::App which wouldn't get type piracy. Another -- perhaps nicer -- possibility would be to have an alternative function for writing apps to html which can have whatever arguments, and just have Base.show call that. What do you think?

The example works, except when replacing the fragment there is an exception resulting from a date change targetting a now deleted element. This is essentially something stale being sent and it should get thrown away at some point rather than throwing an exception. I also haven't figured out how to tear down the task together when the session gets closed. Is it possible to receive an event for this? I think the task would still be stopped too late to solve all stale updates. Any guidance of whether there is existing stuff for this? If not, should I next add some events for session teardown?

@frankier
Copy link
Contributor Author

I don't understand the errors. Something to do with bundling, but I didn't edit any Javascript in this PR.

@frankier frankier marked this pull request as ready for review October 19, 2024 15:54
@frankier
Copy link
Contributor Author

Okay well I think the best thing to do is add a show_html(...) method so keywords can be passed through cleanly, and then dispatch from show(... MIME"text/HTML" ...) to that. Hopefully this fits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant