Unverified Commit ee86ace5 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Fix hash apply after server-patch action (#48813)

### What?

Mux reported that their website does not scroll to hash when clicking a search result. Found it's related to `server-patch` triggering and overriding the hashFragment. That should be preserved similarly to `apply`.

### How?

handleMutable had a default of `null` instead of using the existing value. It should use the existing value.
parent a18f50a3
......@@ -39,7 +39,7 @@ export function handleMutable(
mutable.hashFragment && mutable.hashFragment !== ''
? // Remove leading # and decode hash to make non-latin hashes work.
decodeURIComponent(mutable.hashFragment.slice(1))
: null,
: state.focusAndScrollRef.hashFragment,
segmentPaths:
mutable?.scrollableSegments ?? state.focusAndScrollRef.segmentPaths,
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment