8000 Component Props Array & Map. Stabilize reference fetching by jobelenus · Pull Request #6144 · systeminit/si · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Component Props Array & Map. Stabilize reference fetching #6144

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? 8000 Sign in to your account

Merged
merged 2 commits into from
May 18, 2025

Conversation

jobelenus
Copy link
Contributor
@jobelenus jobelenus commented May 17, 2025

First commit: Array and Map "add/remove" is now working! PSA for @vbustamante and @jkeiser when I delete one element of an array, they all get deleted, seems to be an API bug?
Second commit: Big stabilization of web worker reference checking and returning

@github-actions github-actions bot added the A-web label May 17, 2025
Copy link
github-actions bot commented May 17, 2025

Dependency Review

✅ No vulnerabilities or OpenSSF Scorecard issues found.

Scanned Files

None

@jobelenus jobelenus requested a review from britmyerss May 17, 2025 12:52
@jobelenus jobelenus force-pushed the jobelenus/arrays-and-maps branch 2 times, most recently from 98a202d to 67b455c Compare May 17, 2025 17:13
@jobelenus jobelenus removed the request for review from britmyerss May 17, 2025 17:15
@jobelenus jobelenus force-pushed the jobelenus/arrays-and-maps branch from 67b455c to 6b51468 Compare May 17, 2025 17:16
@jobelenus jobelenus marked this pull request as ready for review May 17, 2025 17:17
@jobelenus jobelenus enabled auto-merge May 17, 2025 17:53
@jobelenus jobelenus changed the title Component Props Array & Map Component Props Array & Map. Stabilize reference fetching May 17, 2025
@jobelenus jobelenus force-pushed the jobelenus/arrays-and-maps branch from 2ef7278 to 883613a Compare May 17, 2025 22:48
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const av = data.attributeValues[avId]!;
const prop = av.propId ? data.props[av.propId] : undefined;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const childrenIds = data.treeInfo[avId]!.children;
Copy link
Contributor

Choose a reason for hiding this comment

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

ok - seeing this, I haven't looked more closely, but I could smash the prop and av together in a single struct with only what we need here. I assume documentation, link, widget, etc, could live on the AV itself. Let me know what you think!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, this is fine I think. FWIW the "Tree" you see here isn't the prop tree you made. And its not exactly the av tree Jacob made either. I essentially took the tree info and populated it with the objects, and children objects, all the way down. Its useful to have it this way for rendering and fuzzy searching

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah I know - I just mean we can return this exact shape in the MV itself.

:path="props.attributeTree.attributeValue.path ?? ''"
:kind="props.attributeTree.prop?.widgetKind"
:value="props.attributeTree.attributeValue.value?.toString() ?? ''"
:canDelete="props.attributeTree.isBuildable"
Copy link
Contributor
@britmyerss britmyerss May 18, 2025

Choose a reason for hiding this comment

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

is this metadata about the av something you might want in the MV itself? For example, isChildOfMapOrArray or something to that effect

Copy link
Contributor Author

Choose a reason for hiding this comment

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

eh... six of one, half a dozen of the other...

attributeTree: AttrTree;
}>();

// this handles objects and arrays but not empty arrays
const hasChildren = computed(() => props.attributeTree.children.length > 0);
const hasChildren = computed(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

same thing here - this could be in the MV

// this is a choice, we could send through objects that don't match the types
// and potentially have something drawn on the screen—but that seems worse
// for the possible side-effects
if (hasReferenceError) return -1;
Copy link
Contributor

Choose a reason for hiding this comment

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

would love to know more about how this error happens (or could happen) in the first place.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In terms of the "model of the program", its pretty straightforward why this could happen. A bundle of patches are not guaranteed to land on the client. For example:

  • player A makes a new schema variant
  • player B missed that patch (networking blip packets never arrive, offline for a moment, etc)
  • player A makes a component for that variant
  • player B receives a Component patch with a reference to a variant it doesn't have, throw mjolnir to have it returned to you

Why it's happening to me, locally, I'm not entirely sure, just that it was. We can still dive into it, this code just handles the error cases—it doesn't remove them. Either I was doing something dumb, and I've fixed it, or the problem remains and we're handling it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

note that, even if player B in that scenario, was offline, we detect it, they come back online, and we cold start which would get them what they missed. Its still a race. Cold start doesn't block. They could be right on the page making the query with the miss while cold start is still happening...

britmyerss
britmyerss previously approved these changes May 18, 2025
Copy link
Contributor
@britmyerss britmyerss left a comment

Choose a reason for hiding this comment

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

This is great work! I'll follow up next week to learn more about the stabilization and game out some scenarios together.

@jobelenus jobelenus added this pull request to the merge queue May 18, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 18, 2025
@jobelenus jobelenus force-pushed the jobelenus/arrays-and-maps branch from 883613a to e50a831 Compare May 18, 2025 11:43
@britmyerss britmyerss self-requested a review May 18, 2025 13:51
@jobelenus jobelenus added this pull request to the merge queue May 18, 2025
Merged via the queue into main with commit 92f7949 May 18, 2025
11 checks passed
@jobelenus jobelenus deleted the jobelenus/arrays-and-maps branch May 18, 2025 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0