-
Notifications
You must be signed in to change notification settings - Fork 10
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
"RuntimeError: unreachable executed" when calling batchedUpdates #31
Comments
Ok, unreachable in this case isn’t an However, in this case, it is almost certainly this line:
In this case, UpdateSummary::summarize() is requesting a built cluster for a cluster that isn’t in the document. Why? Because you called builtCluster manually, without calling drain() afterwards, so the processor considers this to be one of the “touched” clusters that needs to be reported as a change; it got added to the update queue. Filtering out any clusters in the queue that shouldn’t be included would fix this, but you should still make sure you call Perhaps a better API for that use case would be only “give me every cluster and then drain the update queue, consider this point to be client and processor in sync”, although it would be a bit limiting. |
Are you calling builtCluster for the same reason as the demo does? To initialise things? It doesn’t seem like it — you call it after manipulating the document, which is a use case better handled by batchedUpdates as it handles draining the queue itself. Maybe if I could see your code I could help figure out the best way to use the API. |
Where would I pass this flag?
Why is that? If anything, I thought
Based on the documentation I assumed you only call drain if you did a bunch of updates and don't care about the update summary, so you call
This was my assumption about what
I cannot really get the demo to work easily (or the wasm bindings, to be honest, not without the wasm-pack output manual edits, but that can be fixed later, since god know where upstream the problems lie (and/or whether the xpcom environment is just way too weird), and there is a bit of an overwhelming amount of stuff in it, which makes it hard to see what the code flow is, or figure out what data gets fed into the Driver just by reading the code. I call |
As a flag to wasm-pack after a Yeah look, builtCluster is not a great API. I will make it more intuitive. But yes, drain means “I’m in sync, all the updates you have are already known to me” so this would be a place to call it. I will try to remove the drain API as you shouldn’t have to think about it at all. (The reason is that builtCluster is a very thin wrapper over built_cluster. Actually running built_cluster is “recomputing” a cluster, so if it’s called and has to recompute itself and not merely look up a previously computed value, then an update is put in the queue. In your log, it did “recompute” cluster id 1. Your intuition is how it should actually behave.) For previewCitationCluster, is it a requirement that you get a position-correct preview? I can probably do better than a simulation from inside the processor, because you can just pretend it’s the last cluster wherever it may be, figure out what positions the cites would have, build the cluster from them, and forget about the whole reordering before/after dance. For the demo, all of the cluster manipulation is in one file, and almost just the one Document class in Document.tsx, so you can just ignore everything else. Everything else is UI, except useDocument.tsx, which is references and locales and has to be weird because React is, but I wrote a straightforward version at the end to clarify what it’s doing. I would have thought Document would be easy to understand, as it does very little. I guess it also reference-counts the references, but I figured that would be useful too. Probably a bit complicated that everything change happens inside produce(), but that’s how to ensure you never forget to call batchedUpdates() and re-render, and I’d do it again in any other codebase. I don’t know why you’d be having trouble getting the demo app to work — it starts itself, compiles the processor and opens itself in a browser with a single invocation of I’m a little more concerned about the manual edits you mention. Nothing in JavaScript is ever simple, but it really is pretty standard JS when you build it like we discussed in that other issue. Are you working on a branch that I can look at? |
Yes. Although implementing this as a client of the library isn't too bad.
I'm just replacing the final line of the file generated with
to
since However, this issue also kinda exacerbates the annoyance with the js-demo, since it requires a different As for the js-demo, it's best feature: batteries included is also its worst feature, since the bulk of the code is setting up UI and React stuff. But also it would help a lot if it used its own instance of bindings, otherwise you need to clone out a certain not-entirely-obvious part of the project somewhere else if your build of wasm-bindings is different from what the ones that js demo uses and you want to have it running alongside whatever you are doing in the project. It helps most when you have it running and are able to inspect the variables during runtime (since following control flow by reading code is not easy, nor necessary, if you just care about a specific API call).
In #26 I was getting an error when feeding references to the processor which was producing errors. Looking at Document.ts alone just wasn't enough and useDocument.ts was too dense and too much effort to understand compared to getting the demo to work and using a debugger. This would be easier had I had a chance to use hooks in React, but I have not. |
https://developer.mozilla.org/en-US/docs/Web/API/Window/self ... but I appreciate this is probably an XPCOM thing. You could always just put With the separate build annoyance, either of us can improve that by moving it from pkg to somewhere else since the destination directory is configurable. As for following control flow, personally, I rarely if ever use breakpoints at runtime. I just have a good editor and use Go To Definition liberally (absent that, a nice shortcut for searching the codebase for the word under the cursor). |
Zotero debug log
The text was updated successfully, but these errors were encountered: