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

feat: add support for custom fs provider #228

Merged
merged 2 commits into from
Nov 8, 2023

Conversation

CompuIves
Copy link
Collaborator

We're looking to add our own providers for user and cache fs so they can be persisted between sessions. With this change, we don't break the existing API but we can allow for adding custom filesystems for these providers.

@CompuIves
Copy link
Collaborator Author

I'm also exposing IndexedDBFileSystemProvider, which I want to use for the user store. Is it okay if that's part of this PR?

@CompuIves CompuIves force-pushed the feat/custom-fs-providers branch 2 times, most recently from b0279d4 to 3479435 Compare November 8, 2023 01:00
@CompuIves
Copy link
Collaborator Author

While I'm testing the code, I can't seem to get the customProviders inside the constructor. I was under the assumption that if it's passed to the staticArguments array, it would be passed as the second argument in the constructor, but it's empty for me. Have you seen something like this before?

@CompuIves
Copy link
Collaborator Author

Ah, found that static arguments need to be passed as first argument, and then the decorators. I'll try that now.

@CompuIves
Copy link
Collaborator Author

That didn't work either. It looks like another place calls createInstance on it (in my case, the simple extension service) and that causes the static argument to be lost. I have another way we can solve this, but it's less nice. I'll commit that as part of the first commit now.

@CompuIves CompuIves force-pushed the feat/custom-fs-providers branch 2 times, most recently from 0f30aee to 18d14a2 Compare November 8, 2023 01:40
@CompuIves
Copy link
Collaborator Author

Ah, I found the issue. The getServiceOverride is called multiple times, also by other services. Because of this, I've decided to create a specific function to override the different filesystem providers. That ensures that we don't accidentally reset them.

We're looking to add our own providers for `user` and `cache` fs so they
can be persisted between sessions. With this change, we don't break the
existing API but we can allow for adding custom filesystems for these
providers.
@CGNonofr CGNonofr merged commit 3b81576 into CodinGame:main Nov 8, 2023
1 check passed
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