-
Notifications
You must be signed in to change notification settings - Fork 18
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
Jarring animation when topmost Q is marked as answered #6
Comments
Just tried my hand at this (First time working with svelte). I believe its related to:
I still don't have a good enough grasp of the Svelte internals to really know what is going on, but I did some debugging/testing and found out that the Good news is that after the changes, not only did it fix this issue but it also resolved #7 and #1. I'll open a PR for the changes sometime tomorrow (I setup lsp on neovim and the formatter went to town on all of the files I was working on, so too keep the PR on the smaller side I'll reapply the changes without the formatting) |
Hmm, interesting. We do intentionally re-assign wewerewondering/client/src/List.svelte Line 58 in b748d1d
So we just need to make sure that we preserve that behavior (or get it some other way). |
I've been working on this bug for a little while now (I thought I had a fix, but it wasn't perfect so still working on it) The reassignment is not an issue with the solution proposed above, since we can use the But as I mentioned the changes did not solve the issue. After a little more digging I'm fairly certain it has to do with calls being made to |
That's interesting — that kind of race should be fairly rare given the frequency of updates though 🤔 |
On the host view the Polling is happening every
Assuming my assumptions are correct, there is a 1/3 (1000ms/3000ms) chance of animation overlap. Additionally I think on production (hasn't been happening locally for me), the client is sending a loadQuestions request right after a properly is toggled without respecting the the 3000ms delay. If that's the case then we would be entering condition |
Ohh, I see, that's helpful. I wonder if the way to do this is with a very very simple debounce. Instead of having the view depend directly on
where the function that assigns the output of animating = true;
setTimeout(500, () -> animating = false) when a property is changed. May need a bit more trickery (like a I think we could also reduce the animation time a little bit — 500ms feels on the long side. |
I actually tested something similar to what you described, it was working well except for the I was really hoping Svelte would provide a My initial implementation relied on a |
Sidenote: To try and simplify the data flow for setting questions:
I was thinking of using a derived store We could make let prev;
const questions = derived([rawQuestions, localAdjustments, votedFor], ([$rf, $la, $vf], set,) => {
const updated = adjustQuestions($rf, $la, $vf);
if (!deepEqual(updated, prev)) { set(updated) }
prev = updated;
}); PS: writing code on a phone is tough :) |
A derived store feels like it makes a lot of sense! |
I observed this during a stream, not sure if it's reproducible.
The text was updated successfully, but these errors were encountered: