Only a single instance of BaseQueryAccessor is allowed w/server side rendering
See original GitHub issueGetting 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:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@chrisfinch we are just in the process of making Searchkit server friendly
hopefully can get a beta out soon
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.