Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: state enhancements and fixes #44

Merged
merged 10 commits into from Sep 16, 2023
Merged

Conversation

andy-haynes
Copy link
Contributor

This PR updates the Component state logic to allow trusted Component instances to parse their own IDs dynamically. This is done with the use of a parentMeta property on the __bweMeta object, analogous to prototype chains.

@vercel
Copy link

vercel bot commented Sep 15, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
bos-web-engine ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 16, 2023 0:02am

@@ -9,7 +9,10 @@ export function parseChildComponentPaths(transpiledWidget: string) {
const source = match.groups?.src;
widgetInstances[source] = {
source,
transform: (widgetSource: string, widgetComponentName: string) => widgetSource.replaceAll(match[0], match[0].replace('Widget', widgetComponentName)),
transform: (widgetSource: string, widgetComponentName: string) => {
const signaturePrefix = `${widgetComponentName},{__bweMeta:{parentMeta:props.__bweMeta},`;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Injecting this into each child Component's call site is how parentMeta is chained along. This is not a great way to do it, might be cleaner to modify the AST directly.

@andy-haynes andy-haynes merged commit 4ca74d9 into main Sep 16, 2023
1 of 2 checks passed
@andy-haynes andy-haynes deleted the feat/state-enhancements branch September 16, 2023 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant