Skip to content

fix: component tags break with two Edge instances or after configure() - #175

Closed
RomainLanz wants to merge 1 commit into
edge-js:6.xfrom
RomainLanz:fix/supercharged-per-instance
Closed

RomainLanz wants to merge 1 commit into
edge-js:6.xfrom
RomainLanz:fix/supercharged-per-instance

Conversation

@RomainLanz

Copy link
Copy Markdown
Member

Hi ! 👋

Two bugs in the superCharged plugin.

  1. The plugin kept its state in one module variable. When a second Edge instance 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.
  2. configure() creates new compilers, and they did not get the tag claim function of superCharged. The plugin runs only once, so after a configure() call that comes after the first render, tags such as @!foo() stayed as raw text.

The plugin now keeps one state per Edge instance in a WeakMap. configure() copies the claimTag function from the old compilers to the new ones. This also keeps tags claimed by user plugins. To read the function, Compiler gets a public claimTagFn getter. This adds to the public API.

Tests: refresh components list of each edge instance and render components as tags after configure. Both fail on 6.x and pass with this PR.

Not covered: AdonisJS calls configure() before the first render, so bug 2 does not affect it.

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.
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

This pull request has been marked as stale because it has been inactive for more than 21 days. Please reopen if you still intend to submit this pull request

@github-actions github-actions Bot added the Stale label Nov 3, 2026
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

This pull request has been automatically closed because it has been inactive for more than 4 weeks. Please reopen if you still intend to submit this pull request

@github-actions github-actions Bot closed this Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant