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

regression: error saving new streets #422

Closed
kfarr opened this issue Dec 1, 2023 · 14 comments
Closed

regression: error saving new streets #422

kfarr opened this issue Dec 1, 2023 · 14 comments
Assignees

Comments

@kfarr
Copy link
Collaborator

kfarr commented Dec 1, 2023

after merging #395

attempting to save a street imported from streetmix results in error:

Error trying to save 3DStreet scene to cloud. Error: TypeError: Cannot read properties of undefined (reading 'default')

This is my mistake, I should have done more testing before deploying this, @Algorush can you help diagnose?

Flow to reproduce:

  • import new street from streetmix, like 3dstreet.app/#https://streetmix.net/kfarr/3/
  • login and click remix
  • note error
  • there is the same error if you go to capture (camera) > export as json

To reproduce locally in this repo:

const entity = document.getElementById('street-container');
const data = convertDOMElToObject(entity);
  • You can also add additional console logging from line 320:
for (const key in data) {
    console.log('defaultData', defaultData);
    console.log('key', key);

Doing so shows that the error is raised after defaultData that contains properties 'cast' and 'receive' and specifically when the key 'receive' is used with property 'default'. Cast and receive is related to shadow, so I'm expected this has to do with the addition of shadows to the scene.

I tried a bunch of things to make this work but none of them worked, you can see my weak attempts here:
https://github.com/3DStreet/3dstreet/pull/425/files

@kfarr
Copy link
Collaborator Author

kfarr commented Dec 1, 2023

Here is a "hot fix" that works: 877f036

If default value can't be fetched reliably it assumes the value is empty string ''

Is this safe to keep as is? Or should the underlying issue be investigated?

@Algorush
Copy link
Collaborator

Algorush commented Dec 3, 2023

Is this safe to keep as is? Or should the underlying issue be investigated?

It works but with errors in console after loading saved scene. I still debuging. I'll continue tomorrow

@Algorush
Copy link
Collaborator

Algorush commented Dec 3, 2023

After I add shadow nad anisotropy in mixinSkipProps constant array, it works well. But I noticed another issue - data-layer-name is saved as an object and not a string. And this (possibly) causes errors when loading a saved scene

@Algorush
Copy link
Collaborator

Algorush commented Dec 3, 2023

No, this is not why saving works now. Without shadow and anisotropy in the mixinSkipProps array saving also works. Perhaps @kfarr you corrected the editor code?

@Algorush
Copy link
Collaborator

Algorush commented Dec 3, 2023

I noticed another issue also, will create new issue in issue list

@kfarr
Copy link
Collaborator Author

kfarr commented Dec 3, 2023

@Algorush the issue with data-layer-name was resolved #423 (comment)

via this

eb2b5c2

@kfarr
Copy link
Collaborator Author

kfarr commented Dec 3, 2023

Perhaps @kfarr you corrected the editor code?

Good question. I updated it on this repo only. The editor pulls json-utils from this repo via index.html script tag. Going forward we should integrate json-utils to be loaded from index.js in this repo so there are not separate versions
877f036

@Algorush
Copy link
Collaborator

Algorush commented Dec 3, 2023

It strange. I was debugging in the repo: creator-usability-epic-v1 and trying-to-fix-422. Yesterday the save function did not work, but today it works. And it works without this correction: 877f036
About using json-utils.js from index.js. I did it in this PR: #352

@Algorush
Copy link
Collaborator

Algorush commented Dec 5, 2023

I finally found the reason, I was busy with other work for the last two days too. The reason for this error with default was that I incorrectly specified the shadow parameter property in aframe-streetmix-parser.js,

placedObjectEl.setAttribute('shadow', 'recieve:true; cast: true');
.
Instead of receive:true I wrote recieve:true. There is no such default value in schema and therefore an error appeared when receiving it. I'll make a check for the presence of properties in schema for the future

@kfarr
Copy link
Collaborator Author

kfarr commented Dec 5, 2023

@Algorush ok will you make a new PR or commit or something that reverts my change if it is no longer needed, and then has your fix instead?

@Algorush
Copy link
Collaborator

Algorush commented Dec 5, 2023

I see that you have already made changes to creator-usability-epic-v1 for this issue. Let it stay there. I'll just add a new PR so that shadows are not saved in JSON. And I'll fix a typo in aframe-streetmix-parser.js

@kfarr
Copy link
Collaborator Author

kfarr commented Dec 5, 2023

@Algorush creator-usability-epic-v1 branch has already been merged. The most recent changes relevant to this ticket are all on main branch. So you'll want to create a new branch based on main and then create a PR from that branch once you've made your changes.

@github-project-automation github-project-automation bot moved this to Backlog (Not Ready) in 3DStreet Dev Tracking Dec 5, 2023
@kfarr kfarr moved this from Backlog (Not Ready) to In progress in 3DStreet Dev Tracking Dec 5, 2023
@Algorush
Copy link
Collaborator

Algorush commented Dec 5, 2023

Ok, created new PR to fix this and similar errors in the future. Same fix as you @kfarr suggested, but without try/catch:
#430
I also created a PR to correct the typo that caused this error: #429. And 1 PR so that the shadow component is not saved in JSON (because it is in the corresponding mixins): #428

@kfarr
Copy link
Collaborator Author

kfarr commented Dec 6, 2023

closed by #430

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants