Owner not setting for context provider

I'm working on an adapter for inertia.js with solid, and I was looking to add providers similar to their persistent layouts, but I can't seem to get the provider to attach to the component properly. The component is not being wrapped in the provider how I was intending it to. I don't know if it's even possible to do it this way.
function Create(props) {
  return (
    <div>
      <h1>Hello</h1>
    </div>
  );
}

// How Inertia attaches persistent layouts to components
Create.layout = (page) => (
  <div style={{ border: "1px solid red" }}>{page}</div>
);

// How I am trying to pass the provider
Create.provider = (page) => (
  <TestContextProvider>{page}</TestContextProvider>
);

export default Create;
function Create(props) {
  return (
    <div>
      <h1>Hello</h1>
    </div>
  );
}

// How Inertia attaches persistent layouts to components
Create.layout = (page) => (
  <div style={{ border: "1px solid red" }}>{page}</div>
);

// How I am trying to pass the provider
Create.provider = (page) => (
  <TestContextProvider>{page}</TestContextProvider>
);

export default Create;
const renderPage = ({
Component,
props,
key,
}) => {
const child = createComponent(Component, { key, ...props });

// Trying to call the provider similar to the layout below
// return Component.provider(child);

// Inertia adapters attach layout to the component here
if (Component.layout && typeof Component.layout === "function") {
return Component.layout(child);
}

return child;
};
const renderPage = ({
Component,
props,
key,
}) => {
const child = createComponent(Component, { key, ...props });

// Trying to call the provider similar to the layout below
// return Component.provider(child);

// Inertia adapters attach layout to the component here
if (Component.layout && typeof Component.layout === "function") {
return Component.layout(child);
}

return child;
};
Full sandbox: https://codesandbox.io/p/sandbox/inertia-solid-dcweir?file=%2Fsrc%2FApp.tsx%3A7%2C9
inertia-solid
Client side SolidJS adapter for Inerta.js
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server