Skip to content

[graphiql] Refreshing page can erroneously create new tabs #2825

@simhnna

Description

@simhnna

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

If you set initial headers and disable shouldPersistHeaders graphiql creates a new tab although it shouldn't

Tabs aren't stored with headers, but the getDefaultTabState function doesn't know about the shouldPersistHeaders flag. So it compares a stored tab without headers with the headers that are passed to graphiql and decides to create a new tab

Expected Behavior

Refreshing the page shouldn't create a new tab

Steps To Reproduce

In this repo edit the renderExample.js setting the var parameters = { headers: '{"foo": "bar"}' };

and shouldPersistHeaders: false,

 ### Module pattern - [ ] graphiql-umd - [ ] graphiql-esm - [ ] graphiql-commonjs ### Environment _No response_ ### Anything else? _No response_ 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions