LocalStorage icon indicating copy to clipboard operation
LocalStorage copied to clipboard

[Bug] Blazored.LocalStorage.js not required?

Open Stuart88 opened this issue 1 year ago • 5 comments

After spending quite a lot of time with this, I think I'm correct in saying that the ReadMe instruction to add the Blazored.LocalStorage.js script to one's project is now obsolete?

Not a bug as such, but a ReadMe bug.

Great library anyway, thanks!

Stuart88 avatar Nov 02 '24 17:11 Stuart88

@Stuart88 This is only required if you wish to use JS Interop Streaming which allows for larger amounts of data to be stored in local storage, see https://github.com/Blazored/LocalStorage?tab=readme-ov-file#using-js-interop-streaming for the details.

When using interactive components in server-side apps JS Interop calls are limited to the configured SignalR message size (default: 32KB). Therefore when attempting to store or retrieve an object larger than this in LocalStorage the call will fail with a SignalR exception.

The following streaming implementation can be used to remove this limit (you will still be limited by the browser).

However, this change is still pending a release to be published to NuGet so unfortunately isn't available yet in v4.5.0 and will need @chrissainty to publish this before it can be used via the package.

CoreyHayward avatar Nov 20 '24 11:11 CoreyHayward

Hi @CoreyHayward With a new WASM project and net9, the Blazored.LocalStorage.js is with 404 on the browser. I'm "bugged" if we need to include manually or not the file. On docs doesn't mention this. Thanks Ricardo

ricardok1 avatar Dec 02 '24 00:12 ricardok1

Hi @ricardok1

If you are using the currently available version from NuGet (v4.5.0) then the js file is not a part of this and you can safely exclude it and ignore the steps under the JS Streaming section of the readme. This section was added as part of the implementation but has not actually been "released" into the package yet unfortunately.

CoreyHayward avatar Dec 02 '24 00:12 CoreyHayward

Hi @CoreyHayward Thanks for the swift reply. I didn't manually included but appears on the browser automatically so it's inserted by the library. Thanks Ricardo

ricardok1 avatar Dec 02 '24 09:12 ricardok1

@ricardok1 Have you compiled the library yourself instead of using NuGet? That's the only way the JS file could be in your project since it's not in the currently released version on NuGet.

What service registration call are you using to setup LocalStorage?

Could you show the full error you're getting and I may be able to help!

CoreyHayward avatar Dec 02 '24 12:12 CoreyHayward