Comments (2)
Do you by any chance use web components or some JS lib? I'm completely unable to reproduce Error: A callback for the method 'component-update'
As for subscription not working after first swap, this is a legitimate bug, but it doesn't seem to be related with the error message you observe
Disregard everything above. For some reason I did not see error message in the console so my initial analysis was completely wrong
from htmx-signalr.
Basically, the following happens
- Message is received
- Target is extracted from hx-target
- Swapping begins
- OOB swapping replaces the target
- The old target is unmounted from the DOM but the reference to it is still alive within the swapping method
- The normal swapping begins
- The element is unmounted so it has no siblings and no parent
- Error is raised
Workaround with innerHTML is working because there is no attempt to access parent or sibling of the target, and there is a lot of guards for empty values, so when it's unmounted from the DOM, no errors happen.
I'll have to do more triagin, for I suspect that this may affect any cases when OOB swap replaces original target. Maybe the issue would have to be moved back to htmx repo
As a general tip, I would advise against using OOB swaps on existing targets. OOB is intended to be used for updates somewhere else on the page, whereas in your case you are handling the same target. Simply returning [1] without hx-swap-oob
from the hub works as expected
[1]
<div id="component" signalr-subscribe="echo" hx-target="this">Some new content here<div/>
from htmx-signalr.
Related Issues (7)
- Htmx Headers HOT 1
- Forms aren't reset after a message has been sent HOT 1
- Fields are always serialized as strings, messages not accepted by the server HOT 6
- scroll:bottom doesn't work with signalr-subscribe
- Send get request after signalR event HOT 9
- htmx-signalr needs to better handle reconnections HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from htmx-signalr.