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

A PROPFIND request is sent to the wrong address from voyager-story if root is provided #252

Closed
sdumetz opened this issue Feb 15, 2024 · 4 comments

Comments

@sdumetz
Copy link
Contributor

sdumetz commented Feb 15, 2024

I'm using voyager-story from a /ui/route in my application, referencing a scene in a separate /scenes/ folder.

It works fine excepts that a PROPFIND /ui/scenes/:scene_name gets sent before CAssetManager.rootUrl could be properly assigned in StoryApplication.evaluateProps().

In the end it boils down to CVMediaManager.baseUrl not being the same thing as CAssetManager.rootUrl until re-set in StoryApplication.evaluateProps() for reasons I do not really understand.

If that's a desired behavior and the reassignment can't be made before the request is sent, I could write a patch where WebDAVProvider makes use of an AbortController to cancel the request in-flight, which would at least hide the error.

@gjcope
Copy link
Collaborator

gjcope commented Feb 15, 2024

Can you provide some more detail on your setup? Are you using the file server included in the Voyager package? have you modified

const fileDir = path.resolve(rootDir, "files/");
to the root of your scene locations? Some more steps to reproduce would be helpful. Generally speaking though, doesn't sound like 'desired behavior' per se, just a tricky order of operations to make sure everything is initialized properly.

@sdumetz
Copy link
Contributor Author

sdumetz commented Feb 16, 2024

Hi,
I'm not using the provided file server in my setup, but was able to reproduce using the default setup. Interestingly, I found that the race condition does not trigger unless dragdrop is enabled :

  • Build voyager (fresh clone, npm run build-dev && npm run build-server)
  • edit dist/voyager-story-dev.html :
<voyager-story dragdrop root="/scenes/<scene_name>/"></voyager-story>

When loading, it fires a PROPFIND /, immediately followed by PROPFIND /scenes/<scene_name>.

This initial request doesn't happen if dragdrop is disabled.

I might be able to investigate this further next week and maybe propose a fix.

@gjcope
Copy link
Collaborator

gjcope commented Feb 16, 2024

Hi @sdumetz ,

I'm not seeing the exact result as you, but generally speaking I think the issue you are seeing stems from the comment here:

// if dragging/dropping have to assume that a non-loading url is still valid

There is a flag to indicate that the base url for the WebDAV requests is valid. The initialization steps won't happen unless it is true. This validation generally happens by attempting to load the document file and setting that flag if successful. When using dragdrop, we can't assume that a non-loading url is invalid as you may have a folder that does not yet have a scene saved. Without explicitly setting that flag, the loading will crash in that scenario.

If you have any ideas for a fix that still works with this dragdrop scenario, that would be great.

@sdumetz
Copy link
Contributor Author

sdumetz commented Feb 19, 2024

Thanks for the tip!

It's just that mediaManager.rootUrl was set after this, and seems to fire the request synchronously.

I tested on an empty directory and dragdrop enabled using the "example server" and it did initialize just fine.

@gjcope gjcope closed this as completed in 2169cbe Feb 29, 2024
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

No branches or pull requests

2 participants