Skip to content
This repository was archived by the owner on Apr 24, 2023. It is now read-only.

Firestore relation broken parent #168

@cristian-milea

Description

@cristian-milea

Describe the bug
Implement self relation categories just like example from cms30-08-ecommerce but with Firestore

To Reproduce
Steps to reproduce the behavior:

  1. use (almost) the same categories.schema.js from example
import CannerScript from 'canner-script';

export default () => (
  <array
    keyName="categories"
    ui="tree"
    title="Categories"
    description="Dealing with relationship data is annoying, but in Canner, it\'s just a few tags and properties."
    dataSource={{name: 'firestore'}}
    uiParams={{
      relationField: "parent",
      columns: [
        {
          title: "Category Name",
          dataIndex: "name"
        }
      ]}}>
    <string keyName="name" title="Category Name" required />
    <relation
      keyName="parent"
      ui="singleSelectTree"
      relation={{
        type: "toOne",
        to: "categories"
      }}
      title="Parent Category"
      uiParams={{
        disabled: (data, treeKey) => {
          return treeKey.indexOf("-") !== -1;
        },
        textCol: data => data.name,
        relationField: "parent"
      }}
    >
      <toolbar>
      </toolbar>
    </relation>
  </array>
);
  1. add 1 parent and try adding 2 children to him
  2. check firestore
  3. See error

Expected behavior
Both children should be under the parent.

Screenshots
Screen Shot 2019-03-29 at 02 57 01
Screen Shot 2019-03-29 at 02 56 52
Screen Shot 2019-03-29 at 02 56 41

Dependencies (please complete the following information):

  • OS: MacOS 10.14.3
  • Browser Chrome 73
  • Node Version v8.15.1
  • Canner Version 3.2.13

Additional context
Relationships (especially self ones) mapping is very confusing in documentation. I honestly don't know how to make uni-directional or bi-directional, and how to do a one-to-many relationship

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions