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.

Main store and sibling renderers don't get updated (alpha.7)

See original GitHub issue

Describe the bug

We’re finding that Redux devtools says actions have occurred in our renderer, but the value in the store in the renderer does not reflect that except in the window where the value update was initiated.

The really confusing this is that even though the value in Redux’s devtools indicates that it’s been updated, as far as I can tell the value in the store has not actually been updated.

Our app has three windows that all come up at the same time, I’m not sure if that may be relevant.

With version one I know it was important to place the enhancer before/after other enhancers. Is it possible the issue is anything like that?

Our code looks like this:

configurestore.js


  middleware.push(sagaMiddleware);

  if (scope === 'renderer') {
    if (options.runStorage) enhancers.push(electronStorage());
    enhance
  }
  if (scope === 'main') {
    enhancers.push(require('electron-redux').mainStateSyncEnhancer());
  }

  const store = createStore(
    rootReducer,
    initialState,
    composeEnhancers(...enhancers)
  );

  storeProvider.register(store);

storeProvider.js

 const DEFAULT_STORE_OBJ = { getState: () => ({}) };

 class Store {
  constructor() {
    this.reset();
  }

  register = store => {
    this.store = store;
  };

  access = () => this.store;

  getState = () => this.store.getState();

  reset = () => {
    this.store = DEFAULT_STORE_OBJ;
  };
}

export const storeProvider = new Store();

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
matmalkowskicommented, Feb 9, 2021

@Slapbox Middleware creation is synchronous, the async part is only the store hydration -> in default, sync scenario, we will fetch the main store state with blocking ipc call (as in here), and with async scenario we will dispatch message that will than fetch the store with async messaging and than hydrate the store via a built in reducer. But middleware itself is a synchronous code for its creation, and same goes for the store enhancer

0reactions
Slapboxcommented, Feb 10, 2021

Seems to be resolved by #285.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vulkan: Clip Children has wrong blend mode and a rendering ...
Child nodes have ugly color blend and have brightness turn to alpha (full white, fully transparent) rather than keeping their unclipped appearance (seems...
Read more >
React sibling component updates state of parent causing re ...
Problem I'm facing is each call to customCallbackFunction is triggering re-render in both SiblingComponent and DifferentSiblingComponent .
Read more >
Kodi not working? How to fix Kodi problems (Updated for 2022)
Is Kodi not working for you? In this article we'll be explaining how to fix Kodi problems including crashing, and videos that won't...
Read more >
Soft Mask - A replacement of Unity UI Mask with alpha support
Hello @UnbridledGames, First, can I move the mask without having to script 'returning' the position of the child elements?
Read more >
News | 7 Days to Die | The Survival Horde Crafting Game
We're debuting two new items that will soon be listed on our Amazon Store – a newly ... Do not attempt to enter...
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