1,901
questions
0
votes
0
answers
27
views
Return modified query result from action with multiple queries in MST Store
Below is my scenario that I want achieve in an action in the root store:
Call API-1 and get the list
Send ids map from the list to API-2 and fetch the data
Data from API-2 needs to be mapped to the ...
0
votes
0
answers
33
views
Flutter - The UI does not change when the value specified with Flutter Observer is updated
I'm developing a movie application with Flutter. Movies are shown on the page called "Movies". These movies are shown in categories. The user selects a category via TabBar and movies ...
1
vote
0
answers
35
views
Flutter MobX ObservableList not updating UI when modifying items directly
I'm using MobX in my Flutter app and encountering an issue with updating the UI. I have an ObservableList that I use to render a list of items on the screen. The ObservableList is typed as ...
0
votes
1
answer
51
views
Mobx Lazy+Cached
Just on a basic example from the docs
class OrderLine {
price = 0
amount = 1
constructor(price) {
makeAutoObservable(this)
this.price = price
}
get total() {
...
0
votes
1
answer
49
views
Correct Usage of MobX for Managing Comparison State in React Component
I'm a beginner in React and MobX and I'm working on a project where I need to manage the state of compared companies. I want to make sure I'm following best practices and not contradicting the MobX ...
0
votes
1
answer
27
views
Mobx will not reorder the component to change the observable variable
Hey,
If I change the observabl variable using a function in the provider, the value of this.loaded in the sorter is changed to false, but the component that reads this value is not re-rendering.
...
0
votes
0
answers
30
views
Is there a specific way to fetch async data when using React and Mobx?
I'm trying to learn Mobx with React.
I have problem to display fetched data.
I created store, context, provider and view component.
const API_URL = "https://jsonplaceholder.typicode.com/posts&...
0
votes
0
answers
33
views
Webpack mobx stores not reloading
Problem
I am using webpack 5, React 18 and MobX stores. With my current configuration of webpack using HMR and ReactRefresh everything seems to be refreshing just fine, however we are using mobx ...
0
votes
0
answers
26
views
how to test a component that uses state from mobx
when calling the test it gives an error
Test suite failed to run
createRoot(...): Target container is not a DOM element.
5 | import {App} from "./App";
6 |
> 7 | ...
0
votes
0
answers
47
views
Having a problem retrieving data from Spoonacular API
soo im trying to retrieve some data for food items that can be purchased in my app. Ive called the API and i have connected it to my Isar database for local storage but it is not displaying the items ...
0
votes
0
answers
39
views
Lit Uncaught ReferenceError: process is not defined when using mobx
I am building frontend web app using lit framework and mobx, lit-mobx for state management. I am getting 'Uncaught ReferenceError: process is not defined' if I try to use observable property from mobx....
0
votes
1
answer
76
views
MobX State Tree: get a list of references that are using specific identifier
Well, the question is quite straight-forward.
Assume we have some model with identifier
const ReferableModel = types.model({
id: types.identifier(),
})
and an indefinite number of models that can ...
0
votes
1
answer
33
views
How do I need write periodic timer to test connection to the server using Mobx?
I want to write the ReactionBuilder with Mobx, which will check a connection with my server periodicly and do new request to connect it if there is not a connection. How can I do it correctly?
I have ...
0
votes
0
answers
20
views
MobX mixing autorun() and runInAction() to limit reactions
Suppose I want printSum() to run when observableMain changes, but don't want it to react to observableSesondary.
Code below will trigger on both (which is undesirable):
@observable observableMain = 0;...
0
votes
1
answer
80
views
React/Mobx Cannot Override Default Value set by Props
This is probably one of those 'fundamental (lack of) understanding' problems. I'm getting into React, and working on my first major application, and have come across a problem.
Essentially it's this:
...
0
votes
1
answer
63
views
MobX React - Updating a single index of an array of objects is rerendering all children
I have a mobx store of Objects that are being displayed in a list view with a map on the store value like so:
{ObjectStore.objects.map((obj, index) =>
<ObjectItem
key={obj.id}
...
0
votes
0
answers
15
views
Property in MobX is behaving weirdly
I am using Mobx in my react app.
Right now i have this property
@observable
messages: IObservableArray<MessageModel> = observable.array();
and then i have a method that uses that property
...
0
votes
1
answer
65
views
Partial Component Rendering on State Update in MobX or SWR Mutation
Problem: When updating the state in MobX or calling a mutation in SWR, all components are being re-rendered, although I want to update only one element.
Example code:
In the React sandbox, rendering ...
0
votes
1
answer
23
views
my code using mobx doesn't update the state
I have a simple code, I'm new to mobx, its easier in context but I had to use mobx :
import { makeAutoObservable } from "mobx";
import booksRepository from "../Books/Books.repository&...
0
votes
0
answers
10
views
The mobx decorator syntax in the tsx file will not load properly in React native applications after babel conversion
.babelrc
{
"presets": [
"@babel/preset-typescript"
],
"plugins": [
[
"@babel/plugin-proposal-decorators",
{
...
0
votes
0
answers
18
views
Can a JS object Property Made Observable
I saw the documentation for makeObservable() method regarding the "annotations" used as the 2nd parameter in the method, in "Available annotations" part it says:
Annotation ...
0
votes
1
answer
152
views
ObservableStream<List<Type>> convert to List and/or ObservableList<Type> Flutter Mobx
I have setup a sqlite stream from Drift: Stream<List> into my @oberservable class. I can make it an OberserableStream, but I dont understand how to get the list from the stream.
My question is ...
0
votes
0
answers
26
views
const is undefined using mobx and typescript
I have the following code
export const NavViews = {
test: "test1",
test2: "test2"
} as const;
When I do
export class MainViewsStore {
@computed
get ...
0
votes
0
answers
52
views
React useEffect executes before mobx store updates
I have an react app where I check user is authorized with useEffect and mobx. But when useEffect checks store.isAuth it is false and idk after 10 ms it is true, but I am already on another page. ...
1
vote
1
answer
297
views
Mobx with useEffect() not rendered data in component
I'm new to React and Mobx.
I want to init component by data from GET-request in useEffect().
There are simple component with mobx store:
import { autorun } from "mobx";
import React, { ...
1
vote
1
answer
85
views
Property 'store' does not exist on type { } - MobX & React & TypeScript
I keep getting error "Property 'store' does not exist on type '{}'." from TypeScript when using Next.js with Mobx. I'm using Next.js v14.1.0 with the app router setting.
How to properly ...
0
votes
0
answers
27
views
How to initialise TabController in a model when using Mobx State Management and MVVM architecture
This is the model class
import 'dart:async';
import 'package:cali_clinic/helpers/app_exports/app_exports.dart';
import 'package:mobx/mobx.dart';
import '../../../app_nav_setup/app_nav_event.dart';
...
0
votes
0
answers
19
views
object is not being picked up as observable
I'm using mobx to set an object which is a member of a class. But when the object (that is an observable for the class) changes, the view is not picking up that change. Can someone please help? Here's ...
1
vote
1
answer
151
views
MobX build_runner Issue: .g Files Not Generating (Flutter)
I'm attempting to generate MobX .g files in my Flutter project using the flutter pub run build_runner build but I am getting these errors I tried many available solutions but am still getting these:
...
0
votes
1
answer
44
views
Sharing actions between models in mobx-state-tree
I would like to ask you if there's any way of sharing actions between models in mobx-state-tree?
Let's consider this example (login action of AuthModel):
import { types } from "mobx-state-tree&...
0
votes
0
answers
24
views
component not re-rendering when updating an object with mobx
I'm starting with mobx and I'm trying to ensure that my view updates when I add a dashboard by pressing the add dashboard button, when I click on the button the function is called and seems to do this ...
1
vote
0
answers
42
views
createViewModel from 'mobx-utils' gives undesired behavior of dirty state
The createViewModel dirty state does not work properly. On assigning the address property to some other address, createViewModel rightly judge the dirty value to be true however when I revert to the ...
-1
votes
1
answer
104
views
how to make mobx store in single spa application root-config to share data and state among all micro applications?
I am newbie in microfrontends. I am currently using single-spa framework.I have learnt micro frontend applications creation and integration but i am facing problems in sharing data,UI common ...
0
votes
0
answers
34
views
how to re-render component with data from store (mobx)
When I do put request for change info of user, component doesn't re-render. I use mob-x store. I thought that observer() need to re-render it, but when store.user updates it's doessn't work(
export ...
0
votes
1
answer
629
views
In React 16 project, how to use component library created by React 18
I'm making React UI library which uses React v18.2 and MobX v6.12. The library has React and MobX packages internally. (packed together)
I want to use the library in my another project which uses ...
0
votes
0
answers
69
views
issue in unit testing using mobx
mobx store page
import '../../locator.dart';
import '../../shared/model/forum/forum.model.dart';
import '../../storage_manager.dart';
part 'social_store.g.dart';
class SocialStore = _SocialStore with ...
0
votes
1
answer
93
views
The problem with the fetch request in MobX and React
I'm trying to download data from the server and output it to the console for verification, but for some reason undefined is output
MobX:
import { makeAutoObservable } from "mobx"
class Data ...
0
votes
1
answer
432
views
Force a component to render using ag-grid
Hi guys I´m creating a table using ag-grid and react where i have customized celleditor, basically I just need to set the value on my table once we choose an option, but for some reason the value is ...
0
votes
0
answers
49
views
Flat list re-rendering when state change
this is my component when the liked state change imported from mobx, the function handleLikeSubject takes time to finish the execution due to the re-render of the FlatList, how can I get rid of the re-...
0
votes
1
answer
277
views
How do I iterate over an array in Mobx without triggering the "Derivation 'observer' is created/updated without reading any observable value." warning
I'm using:
"mobx": "^6.6.2",
"mobx-react-lite": "^3.4.0",
And want to do a simple .map over an array of stores in my .tsx (.items is of type MenuStore[])
{...
0
votes
0
answers
25
views
Why basic example in mobx with react createContext don't have default value?
Here inside "using React context" tab you can see:
const TimerContext = createContext<Timer>()
But actually it will not work, because
Expected 1 arguments, but got 0.ts(2554)
index.d....
0
votes
1
answer
36
views
Variable passed to endpoint is returning value and undefine simultaneously
getFoodTemplate(subscriptionDuration:any, menuId:any) {
const request = createAxiosInstance(this.token);
runInAction(() => (this.loading.getFoodTemplate = true));
request`enter code ...
0
votes
1
answer
177
views
Mobx computed not updating
mobx getter does not seem to react to changes in localStorage.
class Test {
constructor() {
makeAutoObservable(this);
this.setCount = this.setCount.bind(this);
}
private static ...
0
votes
0
answers
37
views
How does flutter_mobx tracks dependencies in Observer widget?
I have created small reactive widgets using Stream and ValueListenableBuilder. As far as I know, those widgets receive a Listenable or ChangeNotifier as a parameter. Like:
StreamBuilder<int>(
...
0
votes
0
answers
24
views
Why does MobX behaviour change if observable is logged?
I have the following classes, simplified for readability:
const TimelineTable = observer(() => {
const [timeline] = useState(() => getTimeline())
console.log(timeline.pointsInTime.length)
...
0
votes
0
answers
23
views
MobX makeAutoObservable does not create actions [duplicate]
I have a MobX-Store setup with makeAutoObservable(this). I would expect this to mark the methods that write to observable state as actions. Yet that does not seem to be the case. Here's what I did:
I ...
0
votes
1
answer
224
views
How can I observe a list inside an observable when using MobX in Flutter?
I have a simplified situation that I can't make to work in Flutter: a MobX observable object (Book) has a list of chapters that I also want to observe so my UI is redrawn to show a new chapter just ...
-2
votes
1
answer
1k
views
Next.js 14 with Mobx [closed]
How do I integrate the Next.js 14 app router with Next.js? I have integrated the Next.js 14 app router with MobX, but the UI does not update when I update the store data. Before this, I was getting an ...
0
votes
0
answers
39
views
Should I passdown useContext variables as props in a strict parent-children relationship components in React?
I have several components with a strict parent-children relationship, and some commonly used variables are accessed through useContext, which is applied directly to the MobX-State-Tree store.
I have a ...
0
votes
0
answers
22
views
How to prevent component re-rendering in Mobx's action method
import {action, makeObservable, observable, runInAction, toJS} from "mobx";
class DesignerStore {
constructor() {
makeObservable(this, {
layerConfigs: observable,
...