Skip to content

om.next dedpue parser

Petter Eriksson edited this page Dec 6, 2017 · 3 revisions

Multiple UI components can depend on the same query roots and we don't want to execute queries for the same roots more than once, so we dedupe the query roots and merge the pull patterns.

Check out eponai.common.parser/dedupe-parser. It takes an om.next/parser and the parser's read function and returns a new parser. It will return the same response as a normal om.next/parser, just not executing the same root queries more than once. Since the pull patterns have been merged and there's only 1 occurrence of every query root, every UI component that has requested a certain query root will get the same data, possibly more than they asked for.

This dedupe parser also solves a problem in om.next (https://github.com/omcljs/om/issues/869) having to do with om.next/transform-reads that’s called in a few places.

Using the dedupe parser is a server performance improvement, as the client won't request as large queries.