Skip to content

Refactoring PR #1: fixing regressions, keeping the downloader #3

@elabx

Description

@elabx

Heads-up @markusthomas — opening this to document a refactor I'm about to do on top of #1. The downloader feature you added is great and staying as the default. Listing the issues here so you're in the loop.

Work will happen on branch refactor/pr1-cleanup.

Context

The downloader is the right default. For users who want to manage Alpine.js themselves (e.g. version-control it in site/templates/), 5339aca already added a custom_file config option + hookable getCoreScriptUrl(). So both paths are supported.

Issues to fix

1. Fresh-install UX

The bundled alpinejs/3.10.2/alpine.js was removed. A fresh install with no network access — or before the user clicks "Download" — loads nothing at all and gives no feedback. Plan: either restore a bundled fallback, auto-download on install, or surface a clear "no Alpine loaded — click Download or set a custom path" message in the admin.

2. Init-order regression (already fixed in bbb430a)

The switch from adminTheme->addExtraMarkup('head', ...) to $config->scripts->add() caused Alpine to initialize before admin Inputfield JS could register alpine:init listeners. Fixed in bbb430a — noting it here for completeness, since the original module was already doing this correctly before the rewrite.

3. Hardcoded plugin list with unused values

protected static $pluginsList = [
    'mask' => 'cdn.min.js',
    'intersect' => 'cdn.min.js',
    ...
];

All values are identical and unused. Plan: flatten and make extensible.

4. Config UI cleanup

  • Move inline styles out of PHP markup (the "Update Available" badge)
  • Use PW's standard config save flow instead of manual POST handling + $session->redirect('./') inside getInputfields()

5. Cosmetic churn (note for future)

The PR reformatted the entire file (tabs → spaces, brace style, docblocks everywhere), which made the actual feature changes hard to review. Future contributions: please keep formatting changes in a separate commit from feature changes. 🙏

Plugin version-mismatch bug tracked separately in #2.

Will link the PR here once it's up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions