question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Only a single instance of BaseQueryAccessor is allowed w/server side rendering

See original GitHub issue

Getting the error Only a single instance of BaseQueryAccessor is allowed.

First load works fine, subsequent loads trigger error on server.

Here’s the file I’ve made to try and ensure that only one instance of SearchKitManager is ever created on the server/client. Still no joy!

import { createMemoryHistory, createBrowserHistory } from 'history';

let searchKit;

const getSearchKitInstance = () => {
	if (!searchKit) {
		const SearchkitManager = require('searchkit').SearchkitManager;

		if (WEBPACK_CONFIG_IS_NODE) {
		    searchKit = new SearchkitManager("/", {
		        useHistory: false,
		        searchOnLoad: false,
		        createHistory: createMemoryHistory
		    })
			return searchKit;
		} else {
		    searchKit = new SearchkitManager("/", {
		        timeout: 20000,
		        createHistory: createBrowserHistory
		    });
			return searchKit;
		};
	} else return searchKit;
};

export default getSearchKitInstance;

Any ideas would be greatly appreciated.

Thanks!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ssetemcommented, Jul 7, 2017

@chrisfinch we are just in the process of making Searchkit server friendly

hopefully can get a beta out soon

0reactions
stale[bot]commented, Dec 28, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Only a single instance of BaseQueryAccessor is allowed w ...
Getting the error Only a single instance of BaseQueryAccessor is allowed . First load works fine, subsequent loads trigger error on server.
Read more >
Server-side rendering - Apollo GraphQL Docs
Server -side rendering (SSR) is a performance optimization for modern web apps. It enables you to render your app's initial state to raw...
Read more >
Does useQuery run on server-side rendering? - Stack Overflow
On the client, you only want to create a single global instance of Apollo Client. Creating multiple instances of Apollo Client will make...
Read more >
How to Enable Server-Side Rendering for a React App
In this tutorial, you will initialize a React app using Create React App and then modify the project to enable server-side rendering.
Read more >
How to Partly Server-side Render in React | Pluralsight
Server -side rendering (SSR) renders a SPA (single-page application) on the server and subsequently sends it across to the client.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found