Skip to content

Using get to retrieve store values doesn't trigger a component re-render #86

@vcardins

Description

@vcardins

Description

I might be using it wrongly, so excuse me in this case ...
Using get to retrieve store values doesn't trigger a component re-render

Steps

  1. Create a component which listen to values
  2. Update store values in a different component/provider, etc
  3. Check whether the components which listen/consumes to the store value
  4. See error --> Notice it doesn't get updated

If I use get ... no re-renders

export const ParametersControl = memo(() => {
	const { set, get } = dataStore;

	const collection = get.collection?.();
	const collections = get.collections();
	const colorMap = get.colorMap();
	const time = get.time?.();

image

If I use use ... it re-renders

export const ParametersControl = memo(() => {
	const { set, use } = dataStore;

	const collection = use.collection?.();
	const collections = use.collections();
	const colorMap = use.colorMap();
	const time = use.time?.();

image

Expectation

Should get and use work the same way? What am I missing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions