Skip to content

bug: beforeHydrateFn and afterHydrateFn are containing functions result instead of function references #5884

@tweis

Description

@tweis

Prerequisites

Stencil Version

4.19.2

Current Behavior

The expectation for the values of beforeHydrateFn and afterHydrateFn would be that they contain references to functions or noop. However, the variables currently contain the result of the function if beforeHydrate/afterHydrate have been defined in the options. As a result, a TypeError occurs.

Expected Behavior

The variables beforeHydrateFn and afterHydrateFn always contain a reference to a function.

System Info

System: node 18.18.2
    Platform: darwin (23.5.0)
   CPU Model: Apple M2 Pro (12 cpus)
    Compiler: /node_modules/@stencil/core/compiler/stencil.js
       Build: 1719938890
     Stencil: 4.19.2 🏉
  TypeScript: 5.4.5
      Rollup: 2.56.3
      Parse5: 7.1.2
      jQuery: 4.0.0-pre
      Terser: 5.31.1

Steps to Reproduce

  • Clone the repository
  • Install node dependencies
  • Run build npm run build
  • Run node dist/ssr-server/index.js
  • Run curl -d '{"body": "<html><body></body></html>", "url": "http://localhost:3000/", "labels": [], "settings": []}' -H "Content-Type: application/x-www-form-urlencoded" -X POST http://localhost in second terminal session

Code Reproduction URL

https://github.com/tweis/stencil-hydration-typeerror-demo

Additional Information

No response

Metadata

Metadata

Labels

Bug: ValidatedThis PR or Issue is verified to be a bug within Stencil

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions