Repository navigation
fix: component tags break with two Edge instances or after configure() - #175
Open
RomainLanz wants to merge 1 commit into
Open
RomainLanz wants to merge 1 commit into
RomainLanz wants to merge 1 commit into
Conversation
The superCharged plugin kept its state in one module variable. A second Edge instance replaced it, and the first instance then refreshed the components of the second one. Its own components list never changed again. configure() also created new compilers without the tag claimed by superCharged. The plugin runs once, so after a configure() call that came after the first render, component tags such as @!foo() were no longer converted. The plugin now keeps one state per Edge instance in a WeakMap. configure() copies the claimTag function of the previous compilers to the new ones. The Compiler class gets a claimTagFn getter for this.
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.
Hi ! 👋
Two bugs in the superCharged plugin.
Edgeinstance rendered for the first time, it replaced that state. The first instance then refreshed the components of the second instance, and its own components list stopped changing. A component added to the first instance after that was never converted to a tag.configure()creates new compilers, and they did not get the tag claim function of superCharged. The plugin runs only once, so after aconfigure()call that comes after the first render, tags such as@!foo()stayed as raw text.The plugin now keeps one state per
Edgeinstance in aWeakMap.configure()copies theclaimTagfunction from the old compilers to the new ones. This also keeps tags claimed by user plugins. To read the function,Compilergets a publicclaimTagFngetter. This adds to the public API.Tests:
refresh components list of each edge instanceandrender components as tags after configure. Both fail on6.xand pass with this PR.Not covered: AdonisJS calls
configure()before the first render, so bug 2 does not affect it.