sveltejs/sapper

$session.prop = value replaces $session with value instead

Closed this issue · 1 comments

Describe the bug
The code below, instead of setting $session.user equal to { some: data } sets just $session equal to { some: data }

    import { stores } from '@sapper/app'

    let { session } = stores()

    $session.user = { some: 'data' }
    console.log( $session )

Logs

image

To Reproduce
Use the code I provided above and put it in the component <script> section of any route. Having export let user doesn't make any difference on my end.

Expected behavior
I expect $session.user to be set to { some: data } instead of having $session become { some: 'data' }

Information about your Sapper Installation:

  System:
    OS: Windows 10 10.0.19041
    CPU: (16) x64 AMD Ryzen 7 2700X Eight-Core Processor
    Memory: 6.97 GB / 23.95 GB
  Binaries:
    Node: 14.5.0 - C:\Program Files\nodejs\node.EXE
    npm: 6.14.5 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.423.0), Chromium (85.0.564.51)
    Internet Explorer: 11.0.19041.1
  npmPackages:
    rollup: ^2.26.9 => 2.27.1
    sapper: ^0.27.0 => 0.27.16
    svelte: ^3.24.1 => 3.25.1

Additional context
I didn't have this issue yesterday. It started happening after running npm update. I reverted my package.json to an older one that worked but it still has the exact same behavior. Maybe I didn't rollback correctly, I don't know. None the less, this behavior doesn't make sense to me and I have no idea how to debug it. Discord couldn't help me either.

Severity
It basically breaks my app.

This is a Svelte bug - sveltejs/svelte#5412 - and should already be fixed on master and will be included in the next version.