feat(routes): let a consumer unregister a single route - #13
Merged
Conversation
Routes are only released when their module unloads, so anything with a shorter life than its module keeps answering after the thing that registered it is gone — a CMS page unregistered while its module stays loaded still serves its own layout route. The proxy that could do it is exported, but interface resolution rebinds it, so the object a consumer imports is not the one holding the live registry: the handle has to come from here.
Member
Author
|
@greptile review |
Three cases on the new UnregisterRoute: the id RegisterRoute returned releases exactly that route from the public listing while a bystander keeps serving, with the proxy hearing the string-keyed id; the same id tolerated twice; an id never registered ignored. The cases run against the local build, whose proxy no module attaches in the test harness — the api module binds the harness-distributed copy of the interface. A recording provider keeps the stub-mode proxy from throwing and lets the assertions see what reaches the real registry.
Member
Author
|
@greptile review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Routes are only released when their module unloads. Anything with a shorter life than its module therefore keeps answering after the thing that registered it is gone — the case that prompted this is a CMS page unregistered while its module stays loaded: its
/pagelayoutroute kept serving.routesProxyis exported andRoutesProxy.unregisteralready does the right cleanup (it prunesroutesListas well), but a consumer cannot use it: interface resolution rebinds the export, so the object the consumer imports is not the one holding the live registry. Verified in the AntelopeJS test harness —internal.routesProxy !== routesProxy, and neither removes a route fromgetRegisteredRoutes().Hence a real API next to
RegisterRoute, taking the id it returns.Consumer waiting on this: AntelopeJS/cms#301, where a page now owns and releases everything it registered — every registry but this one.
Greptile Summary
The PR adds a public API for unregistering an individual route using the ID returned during registration.
UnregisterRoute, which delegates cleanup to the live route proxy.Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
Reviews (3): Last reviewed commit: "test(routes): cover the route lifecycle" | Re-trigger Greptile