Om Next tutorial: Components Identity Normalization -- om/db->tree usage

343 Views Asked by At

The Components, Identity & Normalization Om Next tutorial says to evaluate some om.next/db->tree calls at the REPL to understand normalization.

The tutorial has two components, Person and RootView. Person implements om/Ident. Calling (om/tree->db RootView init-data true) normalizes the data with the :person/by-name table, as expected.

I tried doing the same thing with Person instead: (om/tree->db Person init-data true) but the normalization table wasn't in the result.

Can you help me understand how tree->db uses the Person ident with the RootView, but not with the Person?

1

There are 1 best solutions below

2
On

I would recommend doing the interactive tutorial (which is a project you can check out and interactively edit):

http://www.github.com/awkay/om-tutorial

This allows you to interactively play with queries and database formats which will significantly help your understanding.

UPDATE: I've long since created a project called Fulcro. Version 1 stacks on top of Om Next to make things very much simpler, and Version 2 (December 1, 2017) is a standalone library (no longer using Om Next) that has a lot of API compatibility, but improved usability, documentation, and more. https://fulcrologic.github.io/fulcro/