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.

[Discussion] Change Griddle's internal store name

See original GitHub issue

We should consider changing the Griddle store name to be ‘griddle’ (as a default – this name should be a prop) instead of using the default ‘store’. This store is for griddle’s internal state management but causes trouble when people are building custom components and want to connect to their app’s store. There is a work around right now that I’m using in some of my apps where I build an HoC to pass ‘store’ as a prop to the custom component but this is perhaps not as clear as it could be?

This is a breaking change and should cause a bump in major version if we go this route because anyone that has a custom component / plugin that connects on ‘store’ to get Griddle’s data would have to take action to work with this change.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:25 (11 by maintainers)

github_iconTop GitHub Comments

3reactions
dahlbykcommented, Oct 31, 2017

There are two parts to using the current implementation:

  1. Direct Griddle to avoid hiding the default store: either specify a storeKey for each <Griddle> instance, or set Griddle.storeKey globally (c.f. https://github.com/GriddleGriddle/Griddle/pull/751)
  2. Use the appropriate connect:
    • To have a component access your app’s default store:
      import { connect } from 'react-redux';
      
    • To have a custom Griddle component access its <Griddle>'s store:
      import { connect } from 'griddle-react';
      

You can see this in action here (note use of reduxConnect, imported from react-redux, compared with plain Griddle connect for other stories’ custom Griddle components).

cc @peroperje @archy-bold


Redux is supposed to be the sole source of truth for the app after all.

I’m sure you’ll find varying opinions on this, but I would say Redux is supposed to be the sole source of truth for application state, which doesn’t necessarily encompass view state like grid pagination and form inputs. That’s not to say you can’t use Redux for these things, but it’s far from universal.

Wouldn’t it make more sense to allow a configurable location in the existing redux store for storing the griddle state. Similar to how redux-form integrates.

Though Griddle obviously requires Redux to work, it seems reasonable that it should Just Work™️ when used in an app that doesn’t otherwise use Redux. So requiring redux-form-style integration seems a non-starter.

More generally, though, important extensibility comes from having a store per instance: plugins are able to modify initialState and provide their own reducers. I’m not sure how to achieve this plugin pattern with a single store, short of putting per-instance reducers into Redux (which breaks serializability).

1reaction
aaronsmulktiscommented, Nov 18, 2021

thank you @dahlbyk !!! importing connect from griddle-react fixed my issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Griddle - Cook up something delicious. - GitHub
Griddle - Cook up something delicious. Griddle is a system of Sass functions and mixins with an accompanying visual grid overlay to help...
Read more >
How To Store A Blackstone Griddle in 4 Quick Methods
Storing the Blackstone griddle isn't all that hard. Certain things can change based on your home or yard size, but the basics always...
Read more >
Griddle Vs Grill — What's the Difference? How and What to ...
What are the differences between a grill and a griddle? They are important as to how they cook, and what you cook on...
Read more >
How to Buy Flat Top Grills & Griddles | Buying Guide - BBQGuys
Things like portability, installation, and refueling are huge considerations in the fuel-type discussion, so let's take a close look at what separates propane ......
Read more >
Does anyone like the built in griddle on their gas range top?
I have the dual fuel 6 burners with the griddle between. The finish on the griddle plate peals off after one year and...
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