o-development / ldo

Monorepo for Linked Data Objects (ldo)
MIT License
23 stars 5 forks source link

Create @ldo/solid-vue #34

Open elf-pavlik opened 3 months ago

elf-pavlik commented 3 months ago

I hope to find time and do it eventually. It should be similar to @ldo/solid-react For now, capturing conversation from the matrix chat.

@elf-pavlik Actually, to make it fine-grained, the LDO proxy would need to call track(target, TrackOpTypes.GET, key) as vue proxy does here https://github.com/vuejs/core/blob/main/packages/reactivity/src/baseHandlers.ts#L143 I'm not sure if it would be possible in a potential @ldo/solid-vue package to import track from @vue/reactivity and have it called in the LDO proxy get trap.

@jaxoncreed Yeah, I think this is on the right track. For inspiration, look how this is done for the react library. Every LDO Proxy includes something called a "Proxy context" with the methods "createSubjectProxy" and "createArrayProxy" (https://github.com/o-development/ldo/blob/main/packages/jsonld-dataset-proxy/src/ProxyContext.ts#L49-L87). You can extend ProxyContext and override these methods to build your own ProxyContext that uses track, similar to how it's done for the react library (https://github.com/o-development/ldo/blob/main/packages/solid-react/src/util/TrackingProxyContext.ts#L44-L89). Then, when you want to use your special Linked Data Object with your custom proxy, inject that into an LdoBuilder (https://github.com/o-development/ldo/blob/main/packages/solid-react/src/useSubject.ts#L42-L56)