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

SSR Support: delete substate.error property (Next.js getServerSideProps) #152

Merged
merged 1 commit into from
Jan 19, 2021

Conversation

gfortaine
Copy link
Contributor

@gfortaine gfortaine commented Jan 18, 2021

Addresses points brought up in #88 (comment).

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jan 18, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 6e0a038:

Sandbox Source
React Configuration
React Typescript Configuration
rtk-query-demo Configuration
svelte-app-rtk-simplequery-demo Configuration

@gfortaine gfortaine changed the title set error to null instead of undefined to enable SSR with Next.js (getServerSideProps) remove setting error to undefined to enable SSR with Next.js (getServerSideProps) Jan 18, 2021
@phryneas
Copy link
Collaborator

Hmm. I'm honestly flabbergasted by the stuff next.js is pulling there, but oh well.

I'd suggest we do delete substate.error here though - not unsetting it at all would lead to pretty weird behaviour in some situations.

@msutkowski
Copy link
Member

How does everyone feel about just defaulting to null instead of undefined? Is that a better long-term solution for this?

@phryneas
Copy link
Collaborator

Well, it could also just not be present yet or have never been set. And I kinda don't see the point of setting a property to null when it has never been accessed yet - especially since we would have to do that to others then as well consequently.
So I'd rather just use delete X instead of X = undefined.

@gfortaine
Copy link
Contributor Author

@phryneas PR updated with delete substate.error as suggested 👍

@msutkowski msutkowski changed the title remove setting error to undefined to enable SSR with Next.js (getServerSideProps) SSR Support: delete substate.error property (Next.js getServerSideProps) Jan 19, 2021
@msutkowski msutkowski added the ssr label Jan 19, 2021
@msutkowski msutkowski merged commit e6b60e0 into rtk-incubator:next Jan 19, 2021
@msutkowski
Copy link
Member

Thanks again for this @gfortaine! 🎉

@gfortaine gfortaine deleted the buildSlice/ssr branch January 19, 2021 22:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants