fix: Programatically added storage mounts are missing in storeage view
đ The bug
Mount points added via nitro plugin do not show up in storage view.
đ ī¸ To reproduce
https://stackblitz.com/edit/github-hd8qczj6?file=server%2Fplugins%2Fstorage.ts
đ Expected behavior
Mount points added via nitro plugins do show up in storage view.
âšī¸ Additional context
No response
There seems to be an issue here: https://github.com/nuxt/devtools/blob/77ef5ce4e147d55243f09259f44d3ab08e941255/packages/devtools/src/server-rpc/storage.ts#L30-L35
Yes, exactly.
I tried fetching the mounts when the RPC is called. But its still missing the mount I added via the nitro plugin đ¤
//...
async getStorageMounts() {
return storage?.getMounts()?.reduce <StorageMounts>((mounts, mount) => {
if (shouldIgnoreStorageKey(mount.base))
return mounts
mounts[mount.base] = {
driver: mount.driver.name,
...mount.driver.options,
}
return mounts
}, {}) ?? {}
},
//...
The 'asset' mount is available either...
I took a look at nitro, and it seems like it create to different storage instances
https://github.com/nitrojs/nitro/blob/4b29402c13e60c3be2b5bcebaad635ab79d16572/src/nitro.ts#L45
and here
https://github.com/nitrojs/nitro/blob/4b29402c13e60c3be2b5bcebaad635ab79d16572/src/build/plugins/storage.ts#L53
The first one is the one we can access in the nitro:init hook. The second one is the one we can access within nitro plugin.