1,430 questions
2
votes
2
answers
99
views
how is the ref-safe-context determined in c# when ref assigning to local variables
I am a beginner in C# trying to figure out how ref-safe-context is defined in C#. I declared a function Foo which didn't work since it tries to ref assign a variable with declaration-block to a ref ...
4
votes
1
answer
116
views
C#/.NET: why can't I pass ref readonly variable into another method that require ref readonly variable?
Consider this code:
struct Struct { public int Num; }
class Program
{
public void A(ref readonly Struct s) { }
public void B(ref readonly Struct s) => A(ref s);
}
I get a compilation ...
0
votes
2
answers
35
views
Modifying refs in an array
I have a scenario involving a 3rd party component in an array:
let array = [{comp:(<Component/>)},{comp:(<Component/>)},{comp:(<Component/>)}]
array.map((arElem, index) => (
<...
-1
votes
1
answer
86
views
Is a reference parameter in a static method in a static class in C# .NET thread-safe?
Please consider the following class/method being called from a Blazor page instance class. My question is: if two threads call the MyStaticMethod concurrently passing the same ref int index reference ...
0
votes
0
answers
41
views
Disabling Form Submit Button Vue3
I would like to disable the submit button in my Vue application if the user hasn't entered data in the donationInput input field. I'm sure I'm missing something basic, thanks for your help identifying ...
3
votes
3
answers
126
views
Does accessing a field on a struct returned by ref copy the struct?
Given the method
ref readonly State GetState();
where State is a struct, the following code accesses State.SimTime without copying State:
ref readonly var state = ref GetState();
var t = state....
2
votes
1
answer
217
views
CS8347/CS8352 with "ref struct" and "in" / "ref" parameter
I have a function with following signature
State MoveForward(in Path path);
Path is a ref struct
State is also a ref struct with just integer.
Now I have another helper function
bool TryMoveForward(...
1
vote
1
answer
51
views
Identity checks with ref values in Vue3 not working as expected
This official Vue.js documentation claims that the ref() API in Vue 3 uses getters and setters.
In Vue 3, Proxies are used for reactive objects and getter / setters are used for refs.
This would ...
0
votes
0
answers
187
views
Type is not assignable to type UnwrapRef
The below code shows an error on the line
tableItemsOptions.value.search = searchArray
Error:
Type 'Record<string, string | null>' is not assignable to type 'UnwrapRef<Record<keyof T, ...
0
votes
1
answer
85
views
Why ref.value can't access private properties declared with #, but with TypeScript's `private` it can?
I have two classes declared.Goods and User
class Goods {
#price: number
#quantity: number
constructor(price: number, quantity: number) {
this.#price = price;
this.#quantity =...
0
votes
1
answer
84
views
Ref parameters and async task
First of all, I understand that the ref, in and out parameters are forbidden in asynchronous tasks.
However, as I have this need, I'm trying to find the cleanest, simplest and most effective solution.
...
3
votes
1
answer
63
views
Behavior "ref" and "const ref" in Chapel
I am trying to understand the behavior of ref and const ref applied to the members of a composite type (e.g. record). Here, is it OK to assume that the behavior of them is similar to auto& and ...
2
votes
1
answer
34
views
touchmove event listener stops firing on mobile when updating a ref, works fine on desktop
I am working on a schedule component in React, the relevant code is available in this code sanbox.
And can be accessed here: https://6rcv9w.csb.app/
As the console logs show the touchmove event stops ...
0
votes
1
answer
98
views
How to disable next button of the vue-form-wizard? or override it with custom button and hide only the next button
I am new to vue js, I am using this vue-form-wizard and I am not sure if there is a way to disable the next button by some conditions, so depends on the conditions will enable or disable the button
&...
0
votes
0
answers
120
views
Expression produces a union type that is too complex to represent.ts
I am creating a react component that creates a custom html element and sets innerhtml using dangerouslySetInnerHTML, everything goes fine but the issue arises when I provide the dynamic type to the ...
0
votes
1
answer
183
views
How Vue3 @/v-on event function passing work?
<input type="file"
id="fieldBoxContentAddPhoto"
accept="image/png"
@input="inputPhoto(this,fieldBoxContentAddPhoto2,fieldBoxContentAddPhoto3)"
>
<...
1
vote
1
answer
327
views
why ref does not get value in conditional rendering
i have a component which renders conditionally and i pass a ref to it via forwardRef of React ,but when condition met and component renders, the ref still has not any value,
what should i do?
here is ...
0
votes
1
answer
186
views
Function components cannot be given refs. MUI v5 Autocomplete
i'm trying to use custom component for ListboxComponent prop in Autocomplete MUI v5, but i'm getting this error:
Function components cannot be given refs. Attempts to access this ref will fail. Did ...
1
vote
1
answer
199
views
When is it recommented NOT to use Eigen::Ref for parameters?
I'm currently writing a lot of functions that accept blocks and expressions as input. I generally find it much easier to work with Refs, as they are simple, lightweight, and it's also easy to ensure ...
1
vote
1
answer
297
views
ref not available in HTMLAttributes<HTMLDivElement>
I have a reusable wrapper component which like this:
import { FC, HTMLAttributes } from "react";
const Wrapper: FC<HTMLAttributes<HTMLDivElement>> = ({
children,
className,
...
0
votes
0
answers
177
views
ref.current.contains(event.target) always returns false
I have a component like this:
const ColumnTaskPrompt = () => {
const promptRef = useRef<HTMLDivElement>(null);
useClickOutside(promptRef, () => {
console.log("do something";...
1
vote
0
answers
903
views
Why does latex give me (??) when I try to reference a figure using \ref{}?
I have tried everything. When I run this in overleaf I get (??) but I'm also able to click the (??) to get to the figure in my pdf so clearly the machine understands what I'm referencing but it doesn'...
0
votes
1
answer
114
views
How can I dynamically determine height of a conditionally rendered component?
I have a component that is conditionally rendered and i don't know the height of it beforehand (and also would like to avoid setting it manually). It should automatically be equal to the size of its ...
0
votes
1
answer
48
views
UI moves when I put a ref in a Box/div
I have the following code:
and it looks like this:
I need to add a div with a reference inside it:
And if I do so, all the UI moves up. See this picture:
I realized this happens only when I add ...
0
votes
0
answers
45
views
Why is there two implementations of ref in react? [duplicate]
There are two variants of ref usage in react:
ref object:
const CustomInput = () => {
const ref = useRef();
return <input ref={ref} />
}
and callback ref:
const CustomInput = () => {
...