algolia / algolia/instantsearch

Back Forward Cache seem broken on iOS + Mac OS Safari

Open
#5,174 0 comments 0 reactions 0 assignees View on GitHub
Feature: Library Library: InstantSearch.js Type: Bug
Dominant language
TypeScript
Stars
4.1k
Forks
554
Avg merge
1d 11h
Merged PRs (30d)
51

Description

## 🐛 Bug description
Back / Forward cache is broken on Safari, iOS Chrome and iOS Safari (at least)
On MacOS, everything is working on Chrome & Firefox.

## 🔍 Bug reproduction
I didn't highlight it in code sandbox cause BF cache seem disabled in code sandbox, but I created an independent app that you can find here : [https://github.com/kevcha/instant-search-safari](https://github.com/kevcha/instant-search-safari)

**Steps to reproduce the behavior:**
1. Go to [https://kevcha.github.io/instant-search-safari](https://kevcha.github.io/instant-search-safari) with Safari (or iOS Chrome)
2. Click on `Samsung` to filter hits
3. Click on any `See more` link
4. Go back using back button
5. Click on `Apple` to filter hits again
6. Click on any `See more` link
7. Go back using back button
8. See that current filter state is `Samsung` instead of `Apple`

**Live reproduction:**
It's live here : [https://kevcha.github.io/instant-search-safari](https://kevcha.github.io/instant-search-safari)

## 💭 Expected behavior
Instant search state should be set to `Apple`, not `Samsung`

## Environment
- OS: MacOS 11 / iOS 16
- Browser: Safari 15, Safari for iOS 16, Chrome for iOS 107

## Additional Context
On codesandbox, as you can see live here : [https://nw2pit.csb.app/](https://nw2pit.csb.app/), BF cache is disabled, clicking back button reload the entire previous page, then scroll position is lost, and the problem don't happen.

Contributor guide

Open the contributing guide

Research direction

Start with the linked reproduction app at github.com/kevcha/instant-search-safari and follow the Safari and iOS Chrome steps using the live demo. Compare the back/forward cache behavior with the CodeSandbox example, then verify that returning after filtering for Apple restores the Apple state rather than Samsung.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.