Skip to content
This repository has been archived by the owner on Sep 23, 2023. It is now read-only.

feat(hook): sanitize handle from routes #12

Conversation

FredrikHillbert
Copy link
Contributor

WHY

Remix has an object called handle on route see here for more info. If you pass a promise or a function to this object the service worker will fail with the following error:

Failed to execute 'postMessage' on 'ServiceWorker': function handleFunction(A, B) {
const props = []
} could not be cloned.

WHAT

We have added a function called sanitizeHandleObject to remove any promise or function from the route.handle.

  • The function sanitizeHandleObject is the function that is checking if the route.handle has any props that is either a function or a promise and if it has that, those will be removed from the object.

Co-authored-by: Samira <samira.ahmed@sas.se>
Co-authored-by: Mette <mette.nordqvist@sas.se>
@ShafSpecs ShafSpecs merged commit 3624b55 into remix-pwa:main Jun 1, 2023
@ShafSpecs ShafSpecs added bug Something isn't working enhancement New feature or request labels Jun 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants