import{j as r}from"./assertThisInitialized-ClXgY4BW.js";import{d as i}from"./dataProvider-BSMCbdJg.js";import{G as d}from"./api-D469Uxm1.js";import{r as a}from"./ideExtension-Duoj5XVI.js";import{u}from"./useGetOne-Ddk2GsYy.js";import{u as l}from"./useUpdate-B6txAJ-A.js";import{B as p}from"./Button-C3j8Wgdd.js";import{A as c}from"./AdminContext-jMMnnv4u.js";import{d as f}from"./defaultI18nProvider-C_r1y4tu.js";import"./index-BP8_t0zE.js";import"./useQuery-DJhJ3Hj4.js";import"./useLogout-DAYYFX4P.js";import"./useDataProvider-BTi1EEZL.js";import"./useMutation-DBpLFNEy.js";import"./undoableEventEmitter-DTIdLI-s.js";import"./PreferencesEditorContext-oPOmBo-a.js";import"./index-qEiLzbkV.js";import"./index-BCKAMao3.js";const _={title:"DataProvider/UseUpdate",parameters:{layout:"centered"},decorators:[e=>x(e)]},t={render:()=>{let{data:e}=u(a("users",{allowContext:!1}),{id:1}),[m]=l(a("users",{allowContext:!1}),{id:e==null?void 0:e.id,data:{name:"New name"}});return r.jsxs(d.Exclude,{children:[r.jsx(p,{label:"Update",onClick:()=>m()}),r.jsx("p",{}),r.jsxs(r.Fragment,{children:["Data: ",e==null?void 0:e.name]})]})}},x=e=>r.jsx(c,{dataProvider:i,i18nProvider:f,children:r.jsx(e,{})});var o,s,n;t.parameters={...t.parameters,docs:{...(o=t.parameters)==null?void 0:o.docs,source:{originalSource:`{
  render: () => {
    let {
      data
    } = useGetOne(resourceName('users', {
      allowContext: false
    }), {
      id: 1
    });
    let [update] = useUpdate(resourceName('users', {
      allowContext: false
    }), {
      id: data?.id,
      data: {
        name: 'New name'
      }
    });
    return <GenerationInstructions.Exclude>
            <Button label="Update" onClick={() => update()} />
            <p />
            <>Data: {data?.name}</>
        </GenerationInstructions.Exclude>;
  }
}`,...(n=(s=t.parameters)==null?void 0:s.docs)==null?void 0:n.source}}};const y=["Default"];export{t as Default,y as __namedExportsOrder,_ as default};
