Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

ishowta/firestore-graph-hooks

Repository files navigation

Firestore graph hooks

Firebase client-side-join library like Graph QL

export const App = () => {
  const [projects, loading, error] = useQuery(getProjects(), (project) => ({
    ownerRef: {
      nowPlayingRef: {},
    },
    kanbans: field(getKanbans(project.ref), (kanban) => ({
      todoLists: field(getTodoLists(kanban.ref), {}),
    })),
  }));

  return (
    <div>
        {projects.map(project => (
            <div key={project.id}>
                <p>{project.data.owner.data?.name}</p>
                <p>{project.data.owner.data?.nowPlaying.data?.title}</p>
                <p>{project.data.kanbans.length}</p>
            </div>
        ))}
    </div>
  );
};

TODO

  • fix bug
    • result do not update on loading
    • should loading variable turn to true when onSnapshot
    • do not use path as key
    • race condition
  • add tests
  • nested document data
  • error handling
  • more strict types
  • snapshot option
  • fragment query
  • flat query result structure mode
  • no restriction reference field name mode
  • documentation
  • add guaranteed to exist option to ref field like extension field
  • performance
    • keep unchanged field
  • support class(withConverter)?
  • internal typing strictly
    • subquery k/v type

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published