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

Update blockprotocol + mock-block-dock. Remove destinationEntityVersionId #553

Merged
merged 14 commits into from
May 13, 2022

Conversation

CiaranMn
Copy link
Member

@CiaranMn CiaranMn commented May 10, 2022

🌟 What is the purpose of this PR?

Upgrades the versions we are using of the blockprotocol and mock-block-dock packages, mainly to eliminate the patching we were doing related to linkedAggregations, following blockprotocol/blockprotocol#302

Since the latest blockprotocol removes provision for destinationEntityVersionId, I have also removed our support for it (that we weren't using) from HASH.

As part of this I actually made a few more changes to bp types locally, to split out the Filter related types further. I am going to defer reflecting these changes back into BP and then updating here again, as it can wait.

🔗 Related links

@github-actions github-actions bot added area/blocks Relates to first-party blocks (area) area/apps > hash* Affects HASH (a `hash-*` app) area/apps > hash-api Affects the HASH API (app) area/deps Relates to third-party dependencies (area) frontend labels May 10, 2022
@CiaranMn CiaranMn marked this pull request as ready for review May 12, 2022 18:10
Copy link
Contributor

@benwerner01 benwerner01 left a comment

Choose a reason for hiding this comment

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

Thanks Ciaran, I think one minor addition to the migration scripts should be made before merging for consistency, but apart from that these changes look good to me 👍

);
const fieldsWithId = (multiFilter.filters ?? []).map((filter) => ({
...filter,
id: uuid(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, why do these filters each have ids in the table block? Just for the purpose of using them in the react key?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure - @teenoh ?

Copy link
Contributor

@teenoh teenoh May 13, 2022

Choose a reason for hiding this comment

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

we need the ids to locate a particular filter from the list of filters and update it's value when there's a change @benwerner01

https://github.com/hashintel/hash/blob/main/packages/blocks/table/src/components/filter-detail.tsx#L177-L179

CiaranMn and others added 3 commits May 13, 2022 06:03
…e-destination-entity-version-id.ts

Co-authored-by: Ben Werner <42802102+benwerner01@users.noreply.github.com>
…e-destination-entity-version-id.ts

Co-authored-by: Ben Werner <42802102+benwerner01@users.noreply.github.com>
@CiaranMn CiaranMn requested a review from benwerner01 May 13, 2022 05:07
benwerner01
benwerner01 previously approved these changes May 13, 2022
Copy link
Contributor

@benwerner01 benwerner01 left a comment

Choose a reason for hiding this comment

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

Thanks Ciaran 👍

Copy link
Contributor

@thehabbos007 thehabbos007 left a comment

Choose a reason for hiding this comment

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

Just adding some things i noticed outside the changes (might be more)
There's a DB error type (which isn't used?) that refers to linked entities being pinned by entityVersionId

invalid: { entityId: string; entityVersionId?: string }[];

@thehabbos007
Copy link
Contributor

The changes to implied history means that the comment here is not true anymore

Entities may also make "fixed" links to specific versions of other entities. The procedure
for deriving the implied history in these circumstances is similar to that outlined in
the example above, except that when a fixed link is encountered, the checkpoint is
immediately moved to the linked version, and it's not changed unless a subsequent version
of the reference entity updates the link.

And I assume we can remove the conditional parts here that deal with fixed VersionIds

// made on entityId), choose the checkpointed version; or if it's a fixed link,
// choose the specified version.
for (const link of refLinks) {
const linkedVersions = entityVersions.get(link.entityId)!;
const linkedVersion = link.entityVersionId
? linkedVersions.find(
(ver) => ver.entityVersionId === link.entityVersionId,
)!
: linkedVersions[checkpoints.get(ref.entityId, link.entityId)]!;
// If the link is fixed, and the position of the specified version in its timeline
// is after the checkpointed version of this entity, then we need to update the
// checkpoint.
if (link.entityVersionId) {
const pos = timelinePos.get(link.entityVersionId)!;
if (pos >= checkpoints.get(ref.entityId, link.entityId)) {
checkpoints.set(ref.entityId, link.entityId, pos);
}

I think this change might be best to do in a separate PR, though.

@CiaranMn
Copy link
Member Author

Thanks @thehabbos007 – removed the unused error and updated comments in dcd8d4e

@lgtm-com
Copy link

lgtm-com bot commented May 13, 2022

This pull request introduces 1 alert when merging c44707c into 4b72242 - view on LGTM.com

new alerts:

  • 1 for Unused variable, import, function or class

Copy link
Contributor

@thehabbos007 thehabbos007 left a comment

Choose a reason for hiding this comment

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

Thanks Ciaran! Looks good to me :)

@CiaranMn CiaranMn enabled auto-merge (squash) May 13, 2022 10:05
@CiaranMn CiaranMn merged commit 874d6a5 into main May 13, 2022
@CiaranMn CiaranMn deleted the cm/update-bp-package-versions branch May 13, 2022 10:06
@vilkinsons vilkinsons added type/eng > frontend Owned by the @frontend team area/tests > integration New or updated integration tests and removed area: frontend labels Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/apps > hash* Affects HASH (a `hash-*` app) area/apps > hash-api Affects the HASH API (app) area/blocks Relates to first-party blocks (area) area/deps Relates to third-party dependencies (area) area/tests > integration New or updated integration tests type/eng > frontend Owned by the @frontend team
Development

Successfully merging this pull request may close these issues.

5 participants