Skip to content

Venndr customisations to Solid - #2

Draft
nikcorg wants to merge 4 commits into
mainfrom
customisations
Draft

Venndr customisations to Solid#2
nikcorg wants to merge 4 commits into
mainfrom
customisations

Conversation

@nikcorg

@nikcorg nikcorg commented Jun 6, 2024

Copy link
Copy Markdown

Don't merge this PR!

Use this branch for adding customisations on top of upstream/main.

Keeping up with upstream

When upstream releases a new version, rebase this branch onto the most recent release tag.

Tag the new customisations head with the most recent Solid tag with a -mg suffix.

E.g. the current version at the time of writing is v0.18.0, making the local version v0.18.0-mg.

Adding further customisations

  1. Add your commits onto this branch
  2. Add a local version tag pointing to the new HEAD, e.g. git tag -f v0.15.2-mg
  3. Push the tag to Github, git push -f --tags
  4. Update the version tag used by any consuming apps

@nikcorg
nikcorg force-pushed the customisations branch 10 times, most recently from 5ac74bc to 4b92225 Compare June 12, 2024 10:24
@nikcorg
nikcorg force-pushed the customisations branch 3 times, most recently from d4080c2 to feb4aa0 Compare July 12, 2024 09:22
nikcorg added 2 commits March 18, 2025 14:55
commit 3188526
Author: Niklas Lindgren <niklas@musicglue.com>
Date:   Tue Jun 11 15:24:24 2024 +0300

    docs(readme): adds new section on including Solid in your project

    This documents the altered approach to including Solid a project, the
    changes to importing the default matchers and how to bring your own
    matchers for types with bundled matchers.

commit ddcb0fd
Author: Niklas Lindgren <niklas@musicglue.com>
Date:   Tue Jun 11 15:24:05 2024 +0300

    test(test helpers): add `use Solid` to test helpers

commit 67c60c7
Author: Niklas Lindgren <niklas@musicglue.com>
Date:   Tue Jun 11 15:21:59 2024 +0300

    feat: export a `use Solid` macro for default config usage

    This is a convenience method, that makes including Solid in your project
    using the default config easier.

    This will be the simplest and likeliest upgrade path for most Solid
    users.

commit 2dcd980
Author: Niklas Lindgren <niklas@musicglue.com>
Date:   Tue Jun 11 15:20:28 2024 +0300

    test(matchers): add cases for built-in matchers

commit ac54b6b
Author: Niklas Lindgren <niklas@musicglue.com>
Date:   Tue Jun 11 14:57:33 2024 +0300

    feat!(matchers): exclude bundled matchers by default

    Packages the bundled matchers in a new module `Solid.Matcher.Builtins`,
    adding a `__using__` macro for including them in your own project.

    This is a breaking change, but the only way for supporting custom
    implementations in place of the bundled matchers.

commit 0a86872
Author: Matt Sutkowski <msutkowski@gmail.com>
Date:   Mon Apr 29 21:14:23 2024 -0700

    chore: update docs around render/3 and README
nikcorg and others added 2 commits March 18, 2025 15:08
…filter dispatch (#5)

* feat(matcher): pass render options through to matchers

Change the Solid.Matcher protocol from match/2 to match/3: the third
argument is the options keyword given to Solid.render/3, threaded down
through Context.get_in/4 and every tag's argument resolution (including
for-loop enumerables and render-tag bindings).

This lets custom matchers reach request-scoped data (e.g. the full
rendering context) via render options instead of out-of-band lookups
like ETS tables keyed by request id.

Breaking: all Solid.Matcher implementations and custom matcher_module
modules must take the extra opts argument.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* perf(context): short-circuit scope lookup on first non-nil match

lookup_key/4 evaluated every scope's matcher for every variable lookup
and reduced the results afterwards. With expensive custom matchers on
the outer scope this tripled matcher work: a loop variable hit in
iteration_vars still walked vars and counter_vars.

Iterate scopes in priority order with reduce_while instead, halting on
the first non-nil match. Semantics are preserved: an {:ok, nil} match is
kept as fallback but can be overridden by a later scope's non-nil value.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* perf(filter): dispatch filters via function_exported? instead of rescue

Filter.apply/3 resolved every filter by calling Kernel.apply and
rescuing UndefinedFunctionError, so each built-in filter call raised
and rescued up to two exceptions while probing the custom module.
Check function_exported?/3 first (with a Code.ensure_loaded?/1 fallback
only on miss, so the hot path stays cheap and unloaded custom modules
still resolve).

The rescue stays as a safety net so filters that themselves raise
ArgumentError/UndefinedFunctionError keep falling through to the next
candidate instead of crashing the render.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants