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

V10 world migration #1089

Merged
merged 10 commits into from
Sep 24, 2022
Merged

V10 world migration #1089

merged 10 commits into from
Sep 24, 2022

Conversation

wrycu
Copy link
Collaborator

@wrycu wrycu commented Sep 21, 2022

fix known migration issues and a few non-migration issues because I forgot this was a migration branch :p

Wrycu added 7 commits September 14, 2022 12:53
* migrate item attachments and modifiers in the world and on actors
* NOTE: this does not resolve all errors with the impacted items as it seems some accessors occur before the migration code is executed
    * it does seem to solve issues after the first load, though

#1081
* fix talent accoessor

#1081
@wrycu wrycu requested a review from Esrin September 22, 2022 03:59
Copy link
Collaborator

@Esrin Esrin left a comment

Choose a reason for hiding this comment

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

Nice work! Couple things below

modules/helpers/actor-helpers.js Outdated Show resolved Hide resolved
let item_id = item._id;
delete item_migrated._id;
// persist the changes to the DB
actor.items.filter(i => i._id === item_id)[0].update(item_migrated);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we not just call item.update(item_migrated) here?

Copy link
Collaborator Author

@wrycu wrycu Sep 22, 2022

Choose a reason for hiding this comment

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

nope, it complains that you're trying to modify the ID (even though they match), and the ID is a read-only field, so you can't even delete it

edit: oop it's RO somewhere else but the first half is still true

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

here's the error when it's the way you asked about
image

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is that using the item_migrated object as the param though, after you delete _id from it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh, no, it's simply item.update(item). I'll try your suggestion - misunderstood the first... two times :p

let item_id = item._id;
delete item_migrated._id;
// persist the changes to the DB
game.items.filter(i => i._id === item_id)[0].update(item_migrated);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ditto here item.update(item_migrated)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

also ditto here!

yup, that makes sense :p

Co-authored-by: Matt Stoolman <Esrin@users.noreply.github.com>
@Esrin
Copy link
Collaborator

Esrin commented Sep 24, 2022

Looks like we can't use structuredClone directly as it's only available globally when accessing Foundry through a browser, it breaks if using the electron app.

Going to push a fix for that... we just use JSON.parse(JSON.stringify(theclonedthing)

I'll throw a fix for that and a couple other little deprecations and bugs I noticed when testing a friend's Genesys world.

Copy link
Collaborator

@Esrin Esrin left a comment

Choose a reason for hiding this comment

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

I think we're in a much better state here for starwarsffg and genesys worlds.

@Esrin Esrin merged commit 63731d9 into foundry-10 Sep 24, 2022
@Esrin Esrin deleted the v10-world-migration branch September 24, 2022 19:12
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.

2 participants