| Commit message (Collapse) | Author | Age |
| |
|
|
|
|
|
|
| |
The changes introduced in the previous commit make it possible to detect lost connections and restart them, so do so. The process is pretty simple - a new remote state is spun up using `/api/boot`, swapped in for the existing state, and a `new EventSource` is started from that new remote state to consume events.
This can induce some anomalies. For example, messages that arrive on the server between the loss of one connection and the creation of the next one just "show up" in boot, without ever appearing in the event stream. (This is technically also true on client startup, but it's easier to expect in that situation.) This is something we'll need to consider when implementing things like notifications or unread flags, though the ones we have today, which are state-based, do work fine.
By design, this _does not_ retry either the `/api/boot` call or the new event source setup. Event sources will try to reconnect on their own, up to a point, so that's fine, but we need to build something more robust for `/api/boot`. I want to tackle that separately from detecting lost connections and reacting to them, but that does mean that this is not a complete solution to client reconnects.
|
| | |
|
| |\ |
|
| | | |
|
| |/ |
|
| |
|
|
|
|
|
|
|
|
|
| |
Sorry about the thousand-line omnibus change; this is functionally a rewrite of the client's state tracking, flavoured to resemble the existing code as far as is possible, rather than something that can be parted out and committed in pieces.
Highlights:
* No more `store.writeable()`s. All state is now tracked using state runs or derivatives. State is still largely structured the way it was, but several bits of nested state have been rewritten to ensure that their properties are reactive just as much as their containers are.
* State is no longer global. `(app)/+layout` manages a stateful session, created via its load hook and started/stopped via component mount and destroy events. The session also tracks an event source for the current state, and feeds events into the state, broadly along the same lines as the previous stores-based approach.
Together these two changes fix up several rough spots integrating state with Svelte, and allow for the possibility of multiple states. This is a major step towards restartable states, and thus towards better connection management, which will require the ability to "start over" once a connection is restored.
|
| | |
|
| |
|
|
| |
Only once on load, then once per new message.
|
| |\ |
|
| | | |
|
| | | |
|
| | |\ |
|
| | | |
| | |
| | |
| | | |
That no longer vitally pertains.
|
| | | |
| | |
| | |
| | | |
To facilitate PWA behaviour.
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This is stored locally, and, while parallel to channel info, is not the
same as.
Eventually, this may hold info about moot/decayed channels, and grow
unbounded. That'll need to be addressed.
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
When we hit the boot endpoint, we get the server's view of things. If we
just setChannels with that, we overwrite all our locally-stored info in
on things like lastReadAt. So we need to merge data.
Eventually, this might militate for a `meta` key containing an object of
locally stored data, rather than having to handle each key specially.
|
| | |/
|/|
| |
| |
| |
| |
| |
| | |
Access to "global" (maybe "external?") state is now handled at the top level of the component hierarchy, in `+page.svelte`, `+layout.svelte`, and their associated scripts. State is otherwise passed down through props, and changes are passed up through callbacks.
This is - hopefully - groundwork for refactoring state management a bit. I wanted to move access to state out to a smaller number of places, so that I have fewer places to update to implement reconnect logic. My broader goal is to make it easier to refactor these kinds of external side effects, as well, though no such changes are in this branch.
This change also makes testing a mile easier, since tests can interact with props and callbacks instead of emulating the whole HTTP request stack and the Pilcrow API. This change removes do-very-little tests.
|
| | | |
|
| | | |
|
| | |
| |
| |
| | |
Browsers cope with weird nestings mostly fine, but there's no upside for us in testing that.
|
| | | |
|
| | | |
|
| |/
|
|
| |
It's amazing what you can learn by skimming the docs.
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
own/other messages.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |\ |
|
| | |
| |
| |
| | |
Even when they get mapped to snake_case searchParams.
|
| | |
| |
| |
| | |
I dunno, I like the fleuron. Maybe it's too twee?
|
| | |
| |
| |
| |
| |
| | |
This includes jamming the "at" of a message into a data- attribute on
the Message component, so that it can later be used by parent components
via Plain Old Javascript and the .dataset attribute of an HTML node.
|
| | |
| |
| |
| |
| |
| |
| |
| | |
I tried to have a custom class for Channel objects, but Svelte's
automatic proxy logic works only on bare objects, as far as I could
tell. So that broke everything. I resorted to a function that would
build the bare objects, but we still lack methods that I think would
make life easier ("touch last read" etc).
|
| | | |
|
| |\| |
|
| | |
| |
| |
| | |
Svelte's lint complains if you add interaction to a div but don't give that div an ARIA role.
|
| | |
| |
| |
| | |
If you're setting it to a static value, use set.
|
| | |
| |
| |
| | |
Just use state, don't derive from a non-state local variable.
|
| | |
| |
| |
| |
| |
| | |
rendered.
~16% of the `hi development` channel's rendering time was taken up on this.
|
| |\| |
|
| | |\ |
|
| | | |
| | |
| | |
| | |
| | | |
It's not very legible at small sizes, but it's a first draft, it'll be
fine.
|
| |\ \ \
| | |/
| |/| |
|
| | |/
| |
| |
| | |
This also fixes some rendering jank with the message timestamp chip.
|