Closed samuelstroschein closed 1 month ago
The straightforward solution is to always match against a declaration, not an expression.
const declarations = [
{
"type": "input",
"name": "photoCount"
},
+ {
+ "type": "local",
+ "name": "photoCountPlural",
+ "value": "photoCount: plural"
+ }
]
-const selectors = [
- {
- type: "expression",
- arg: "photoCount",
- annotation: "plural"
- }
-]
const variant = {
match: {
- "photoCount": "many"
+ "photoCountPlural": "many",
// even using both matchers in combination is possible!
"photoCount": "16"
}
}
The UI ran into this ambiguity bug (cc @nils.jacobsen), confirming this problem.
numTodos
overwrites the old numTodos
oneCleanShot 2024-09-18 at 12.36.50.mp4
Having matchOrder: ["photoCountPlural"]
would still be required. As a nice side effect, re-ordering in the UI becomes trivial. One can drag & drop one matcher from left to right.
Closed in https://github.com/opral/monorepo/commit/62db9ca11b4f8830a33c22bf8700505ce5acd585
The change was trivial. Selectors stay as they are but don't use an expression, only a variable reference.
Problem
Matchers reference a key (name) to match against but selectors are expressions and expressions have no key to reference from.
Understanding Match and Selector Definitions in Data Structures 🧩