import { get , set } from "lodash" ; import { FbFormRenderComponentProps } from "../../../types" ; import { SAVE_FORM_VIEW } from "./graphql" ; import { ApolloClient } from "apollo-client" ; const saveFormView = ( { data , client } ) => { if ( ! window || ! data ) { return ; } if ( get ( window , "localStorage.form_view_" + data . id ) ) { return ; } set ( window , "localStorage.form_view_" + data . id , 1 ) ; client . mutate ( { mutation : SAVE_FORM_VIEW , variables : { revision : data . id } } ) ; } ; export default ( props ) => { const { data , preview } = props ; if ( ! data || preview ) { return ; } saveFormView ( props ) ; } ;