This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-08-23
Channels
- # babashka (4)
- # beginners (46)
- # biff (64)
- # calva (34)
- # cider (29)
- # cljdoc (12)
- # cljs-dev (16)
- # clojure (42)
- # clojure-australia (2)
- # clojure-china (1)
- # clojure-europe (35)
- # clojure-filipino (1)
- # clojure-hk (1)
- # clojure-indonesia (1)
- # clojure-japan (1)
- # clojure-korea (1)
- # clojure-my (1)
- # clojure-nl (1)
- # clojure-norway (6)
- # clojure-sg (1)
- # clojure-taiwan (1)
- # clojure-uk (4)
- # clojurescript (3)
- # core-typed (3)
- # cursive (5)
- # datalevin (3)
- # datomic (23)
- # hyperfiddle (92)
- # joyride (8)
- # juxt (3)
- # malli (1)
- # nbb (44)
- # pathom (10)
- # portal (3)
- # rdf (1)
- # reitit (10)
- # shadow-cljs (60)
- # sql (12)
I think I found a weird bug related to reordering of collections that are nested inputs to a resolver:
(ns pathom-reverse-inputs
(:require [com.wsscode.pathom3.connect.indexes :as pci]
[com.wsscode.pathom3.connect.operation :as pco]
[com.wsscode.pathom3.interface.eql :as p.eql]))
=> nil
(pco/defresolver reverse-inputs
[input]
{::pco/input [{:a [:b]}]}
{:input input})
=> #'pathom-reverse-inputs/reverse-inputs
(p.eql/process
(pci/register reverse-inputs)
{:a (list {:b 1} {:b 2})}
[:input])
=> {:input {:a ({:b 2} {:b 1})}}
Am I correct in assuming this is unintentional? I'll write up an issue if so.I remember having this kind of issue before, there is even a helper that checks and reverts the order in such cases, but it might got missed using it somewhere
because Pathom will reconstruct collections as part of the processing, and for lists to keep the order we need to reverse it at the end of the operation
situations where this happens: https://github.com/search?q=repo%3Awilkerlucio%2Fpathom3%20coll%2Fcoll-append-at-head%3F&type=code
I guess there is some case missing in terms of nested inputs
I can work around it for now, thanks for checking!
In Pathom2 there was a helper to sort the output. It was necessary for batch resolvers. https://blog.wsscode.com/pathom/v2/pathom/2.2.0/connect/resolvers.html#_aligning_results
@U4VT24ZM3 Pathom 3 has that too, but this is a different kind of problem, the result align is for batch when you need to ensure the output list has the same size and positions as the input list
but here pathom is just reversing the list order