Questions tagged [global-state]

66 questions
1
vote
2 answers

Global state variable - SwiftUI

Is there a way to have a global state variable in SwiftUI? It would be nice to be able to have all my views subscribe to the same state. Is there some reason not to do this? When I tried to declare a global variable with the @State decorator, the…
zoecarver
  • 5,523
  • 2
  • 26
  • 56
1
vote
0 answers

React and Global state(reactn)

I am currently using react and manage a global state with reactn (https://github.com/charlesStover/reactn). I have to work with "SVG" and be able to make diagrams in the future. I would like for each rectangle that I create, and update the x and y…
Valone
  • 11
  • 2
1
vote
2 answers

Is there a global cross-request cross-session state in PHP?

I'd like to cache some data to be used by all my requests. I'd like an in-memory cache that would get flushed upon the change of a code file (the information is obtained by reflection, and changing the code file will probably invalidate it). Is this…
Vilx-
  • 104,512
  • 87
  • 279
  • 422
1
vote
1 answer

Storing and loading configuration for REST server avoding global state (i.e. singleton vs. context vs. dependency injection)

I am developing an architecture in Java using tomcat and I have come across a situation that I believe is very generic and yet, after reading several questions/answers in StackOverflow, I couldn't find a definitive answer. My architecture has a REST…
1
vote
1 answer

Global state in asp.net mvc application

Problem: Our web console shows a list of all computers on which our application is installed. Each machine has some identification information that can be associated with it. Simple strings like department name, team name etc. We need to make it…
Amith George
  • 5,806
  • 2
  • 35
  • 53
1
vote
7 answers

How to send variables from Main activity to multiple activities in android?

Iam trying to create an application that have MainActivityit is a login page , it contain 4 variable, when i click the login button, it goes to another activity HomeTab using an intent Intent i = new Intent(FirstMain.this,Home_tab.class); …
Sibin Francis
  • 581
  • 2
  • 12
  • 30
0
votes
2 answers

Best Practice for sharing global data over several Thor tasks

I am currently building a Thor executable that supports several different tasks. Some tasks inoke other tasks. For example Auth authenticates the local user Create Invoke Auth Does something Invoke Configure Configure: Invoke Auth Does…
Florian Motlik
  • 386
  • 3
  • 7
0
votes
0 answers

Re-renders using zustand

I have a nextJs application that uses a global zustand state to alter the mouse component that is present in all my application, the problem is that as all the components are subscribed to setDotType every time one of them changes the state all the…
0
votes
1 answer

Context with generic typing

I am in the process of creating a generic component in typescript that we call GenericComponent for a library. I want to achieve the following behavior from my library : function GenericComponent(props: GenericComponentProps) { // ... …
0
votes
1 answer

AlpineJS: How to create and update global props

I'm new to AlpineJS. I have some production knowledge of React and some basics of Vue. But one of the things I'm not getting about AlpineJS and I did not find a direct answer to this from any of the documentation or tutorial videos on AlpineJS,…
Mayeenul Islam
  • 4,532
  • 5
  • 49
  • 102
0
votes
1 answer

Update class nested in zustand store

I am retrieving a list of objects and attempting to store them inside a class I have in my Zustand store. async function initializeData() { const [ computerGroups, {...other vars} ] = await Promise.all([ …
0
votes
1 answer

Vue Js 3 not keeping Pinia global state

I'm working on a project as a little online store. I'm using Pinia to keep the data i'm fetching as an array for the products and other things. Now, I don't know why but the state doesn't keep up. I'm using routing and components to have different…
0
votes
0 answers

Loading data from MongoDB via async call with gobalstate hook within useEffect yields "undefined"

Tech stack: Next.js, React, MongoDB, Mongoose, Zustand (global state) I am saving objects (Flashcards in JSON format) in MongoDB and fetch the data through Mongoose. I use Mongoose's idea of Model and Schema. I want to load all data from MongoDB…
Josh
  • 125
  • 7
0
votes
1 answer

Unhandled Rejection (SyntaxError): Unexpected end of JSON input error popping up for fetch in UserContext component (useContext react)

trying to set up useContext in my project for flatiron school to have global state for the user and am getting this error "Unhandled Rejection (SyntaxError): Unexpected end of JSON input" ``` import React, { useState, useEffect } from "react"; //…
mars916
  • 23
  • 4
0
votes
1 answer

RenderBox was not laid out: RenderRepaintBoundary#9d579 relayoutBoundary=up4 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE

import 'package:flutter/material.dart'; class TaskTile extends StatefulWidget { @override State createState() => _TaskTileState(); } class _TaskTileState extends State { bool isChecked = false; // void…