пипъ trombalny
пипъ trombalny
SSolidJS
Created by Дикий on 3/20/2024 in #support
when changing a dynamic variable that contains json <For> will not be re-rendered
The problem described in the topic description is still active
155 replies
SSolidJS
Created by Дикий on 3/20/2024 in #support
when changing a dynamic variable that contains json <For> will not be re-rendered
no(
155 replies
SSolidJS
Created by Дикий on 3/20/2024 in #support
when changing a dynamic variable that contains json <For> will not be re-rendered
Before the addition of untrack there was an infinite loop
155 replies
SSolidJS
Created by Дикий on 3/20/2024 in #support
when changing a dynamic variable that contains json <For> will not be re-rendered
no, when the page starts(1 time)
155 replies
SSolidJS
Created by Дикий on 3/20/2024 in #support
when changing a dynamic variable that contains json <For> will not be re-rendered
i added untrack
155 replies
SSolidJS
Created by Дикий on 3/20/2024 in #support
when changing a dynamic variable that contains json <For> will not be re-rendered
const start = async () => {
const usersResponse = await getPosts(0, untrack(checkedUsers));
let checked = untrack(checkedUsers);
if (usersResponse) {
checked.push(
String(
usersResponse.success[Object.keys(usersResponse.success)[0]].author_id
)
);

setCheckedUsers(checked);
setUsers(usersResponse);
setAllUsersId(
Object.keys(usersResponse.success).map((user) =>
Number(usersResponse.success[user].author_id)
)
);
}
};
const start = async () => {
const usersResponse = await getPosts(0, untrack(checkedUsers));
let checked = untrack(checkedUsers);
if (usersResponse) {
checked.push(
String(
usersResponse.success[Object.keys(usersResponse.success)[0]].author_id
)
);

setCheckedUsers(checked);
setUsers(usersResponse);
setAllUsersId(
Object.keys(usersResponse.success).map((user) =>
Number(usersResponse.success[user].author_id)
)
);
}
};
?
155 replies
SSolidJS
Created by Дикий on 3/20/2024 in #support
when changing a dynamic variable that contains json <For> will not be re-rendered
yes
155 replies
SSolidJS
Created by Дикий on 3/20/2024 in #support
when changing a dynamic variable that contains json <For> will not be re-rendered
but without {equals: true} swiper working
155 replies
SSolidJS
Created by Дикий on 3/20/2024 in #support
when changing a dynamic variable that contains json <For> will not be re-rendered
No description
155 replies
SSolidJS
Created by Дикий on 3/20/2024 in #support
when changing a dynamic variable that contains json <For> will not be re-rendered
second code repeats billion times
155 replies
SSolidJS
Created by Дикий on 3/20/2024 in #support
when changing a dynamic variable that contains json <For> will not be re-rendered
first code breaks swiperjs
155 replies
SSolidJS
Created by Дикий on 3/20/2024 in #support
when changing a dynamic variable that contains json <For> will not be re-rendered
let [users, setUsers] = createSignal([], { equals: false });
let [checkedUsers, setCheckedUsers] = createSignal([]);
let [allUsersId, setAllUsersId] = createSignal([]);
let [checkedHorizontalPosts, setCheckedHorizontalPosts] = createSignal({});
let [currentUser, setCurrentUser] = createSignal();
let [users, setUsers] = createSignal([], { equals: false });
let [checkedUsers, setCheckedUsers] = createSignal([]);
let [allUsersId, setAllUsersId] = createSignal([]);
let [checkedHorizontalPosts, setCheckedHorizontalPosts] = createSignal({});
let [currentUser, setCurrentUser] = createSignal();
or
let [users, setUsers] = createSignal([], { equals: false });
let [checkedUsers, setCheckedUsers] = createSignal([], { equals: false });
let [allUsersId, setAllUsersId] = createSignal([], { equals: false });
let [checkedHorizontalPosts, setCheckedHorizontalPosts] = createSignal(
{},
{ equals: false }
);
let [currentUser, setCurrentUser] = createSignal();
let [users, setUsers] = createSignal([], { equals: false });
let [checkedUsers, setCheckedUsers] = createSignal([], { equals: false });
let [allUsersId, setAllUsersId] = createSignal([], { equals: false });
let [checkedHorizontalPosts, setCheckedHorizontalPosts] = createSignal(
{},
{ equals: false }
);
let [currentUser, setCurrentUser] = createSignal();
155 replies
SSolidJS
Created by Дикий on 3/20/2024 in #support
when changing a dynamic variable that contains json <For> will not be re-rendered
When we put this option, the code starts replaying a billion times or just breaks SwiperJS
155 replies
SSolidJS
Created by Дикий on 3/20/2024 in #support
when changing a dynamic variable that contains json <For> will not be re-rendered
const onUserHorizontalSwipe = async (user) => {
let json = checkedHorizontalPosts();
let usersStatic = users();
const slide = user.slides.filter((element) =>
element.classList.value.includes("active")
)[0];
let [author_id, id] = [
Number(slide?.id.split(" ")[1]),
Number(slide?.id.split(" ")[0]),
];
if (Object.keys(json).includes(String(author_id))) {
if (!json[author_id].includes(id)) {
json[author_id].push(id);
}
} else {
json[author_id] = [id];
}
setCheckedHorizontalPosts(json);

Object.keys(users().success).map(async (user) => {
if (users().success[user].author_id === author_id) {
const difference =
users().success[user].posts.length - json[author_id].length;

if (difference == 2) {
const postsByUser = await getUserPosts(
users().success[user].posts[users().success[user].posts.length - 1]
.id,
author_id
);

if (postsByUser) {
postsByUser.success.map((post) => {
usersStatic.success[user].posts.push(post);
});
}
}
}
});
setUsers(usersStatic);
};
const onUserHorizontalSwipe = async (user) => {
let json = checkedHorizontalPosts();
let usersStatic = users();
const slide = user.slides.filter((element) =>
element.classList.value.includes("active")
)[0];
let [author_id, id] = [
Number(slide?.id.split(" ")[1]),
Number(slide?.id.split(" ")[0]),
];
if (Object.keys(json).includes(String(author_id))) {
if (!json[author_id].includes(id)) {
json[author_id].push(id);
}
} else {
json[author_id] = [id];
}
setCheckedHorizontalPosts(json);

Object.keys(users().success).map(async (user) => {
if (users().success[user].author_id === author_id) {
const difference =
users().success[user].posts.length - json[author_id].length;

if (difference == 2) {
const postsByUser = await getUserPosts(
users().success[user].posts[users().success[user].posts.length - 1]
.id,
author_id
);

if (postsByUser) {
postsByUser.success.map((post) => {
usersStatic.success[user].posts.push(post);
});
}
}
}
});
setUsers(usersStatic);
};
155 replies
SSolidJS
Created by Дикий on 3/20/2024 in #support
when changing a dynamic variable that contains json <For> will not be re-rendered
const onUserSwipe = async (user) => {
setCurrentUser(user);
const currentPost = user.slides.filter((element) =>
element.className.endsWith("active")
)[0];
let checked = checkedUsers();
if (!checked.includes("" + currentPost.id)) {
setCurrentUser(currentPost.id);
checked.push(currentPost.id);
console.log(checked);
}
setCheckedUsers(checked);

const [usersStatic, checkedUsersStatic, allUsersIdStatic] = [
Object.keys(users().success),
checkedUsers(),
allUsersId(),
];
const difference = usersStatic.length - checkedUsersStatic.length;
let usersJson = users();
if (difference === 1) {
const usersResponseToAdd = await getPosts(0, allUsersIdStatic);
if (usersResponseToAdd) {
Object.keys(usersResponseToAdd.success).map(
(user) => (usersJson.success[user] = usersResponseToAdd.success[user])
);
setUsers(usersJson);
}
}
};
const onUserSwipe = async (user) => {
setCurrentUser(user);
const currentPost = user.slides.filter((element) =>
element.className.endsWith("active")
)[0];
let checked = checkedUsers();
if (!checked.includes("" + currentPost.id)) {
setCurrentUser(currentPost.id);
checked.push(currentPost.id);
console.log(checked);
}
setCheckedUsers(checked);

const [usersStatic, checkedUsersStatic, allUsersIdStatic] = [
Object.keys(users().success),
checkedUsers(),
allUsersId(),
];
const difference = usersStatic.length - checkedUsersStatic.length;
let usersJson = users();
if (difference === 1) {
const usersResponseToAdd = await getPosts(0, allUsersIdStatic);
if (usersResponseToAdd) {
Object.keys(usersResponseToAdd.success).map(
(user) => (usersJson.success[user] = usersResponseToAdd.success[user])
);
setUsers(usersJson);
}
}
};
155 replies
SSolidJS
Created by Дикий on 3/20/2024 in #support
when changing a dynamic variable that contains json <For> will not be re-rendered
const start = async () => {
const usersResponse = await getPosts(0, checkedUsers());
let checked = checkedUsers();
if (usersResponse) {
checked.push(
Number(
usersResponse.success[Object.keys(usersResponse.success)[0]].author_id
)
);

setCheckedUsers(checked);
setUsers(usersResponse);
setAllUsersId(
Object.keys(usersResponse.success).map((user) =>
Number(usersResponse.success[user].author_id)
)
);
}
};
const start = async () => {
const usersResponse = await getPosts(0, checkedUsers());
let checked = checkedUsers();
if (usersResponse) {
checked.push(
Number(
usersResponse.success[Object.keys(usersResponse.success)[0]].author_id
)
);

setCheckedUsers(checked);
setUsers(usersResponse);
setAllUsersId(
Object.keys(usersResponse.success).map((user) =>
Number(usersResponse.success[user].author_id)
)
);
}
};
155 replies
SSolidJS
Created by Дикий on 3/20/2024 in #support
when changing a dynamic variable that contains json <For> will not be re-rendered
155 replies
SSolidJS
Created by Дикий on 3/20/2024 in #support
when changing a dynamic variable that contains json <For> will not be re-rendered
155 replies
SSolidJS
Created by Дикий on 3/20/2024 in #support
when changing a dynamic variable that contains json <For> will not be re-rendered
yes
155 replies
SSolidJS
Created by Дикий on 3/20/2024 in #support
when changing a dynamic variable that contains json <For> will not be re-rendered
No description
155 replies