|
@@ -227,8 +227,8 @@ export const applyEvent = async (event, socket) => {
|
|
|
a.href = eval?.(
|
|
|
event.payload.url.replace(
|
|
|
"getBackendURL(env.UPLOAD)",
|
|
|
- `"${getBackendURL(env.UPLOAD)}"`
|
|
|
- )
|
|
|
+ `"${getBackendURL(env.UPLOAD)}"`,
|
|
|
+ ),
|
|
|
);
|
|
|
}
|
|
|
a.download = event.payload.filename;
|
|
@@ -341,7 +341,7 @@ export const applyRestEvent = async (event, socket) => {
|
|
|
event.payload.files,
|
|
|
event.payload.upload_id,
|
|
|
event.payload.on_upload_progress,
|
|
|
- socket
|
|
|
+ socket,
|
|
|
);
|
|
|
return false;
|
|
|
}
|
|
@@ -357,7 +357,12 @@ export const applyRestEvent = async (event, socket) => {
|
|
|
export const queueEvents = async (events, socket, prepend) => {
|
|
|
if (prepend) {
|
|
|
// Drain the existing queue and place it after the given events.
|
|
|
- events = [...events, ...Array.from({length: event_queue.length}).map(() => event_queue.shift())];
|
|
|
+ events = [
|
|
|
+ ...events,
|
|
|
+ ...Array.from({ length: event_queue.length }).map(() =>
|
|
|
+ event_queue.shift(),
|
|
|
+ ),
|
|
|
+ ];
|
|
|
}
|
|
|
event_queue.push(...events);
|
|
|
await processEvent(socket.current);
|
|
@@ -413,7 +418,7 @@ export const connect = async (
|
|
|
dispatch,
|
|
|
transports,
|
|
|
setConnectErrors,
|
|
|
- client_storage = {}
|
|
|
+ client_storage = {},
|
|
|
) => {
|
|
|
// Get backend URL object from the endpoint.
|
|
|
const endpoint = getBackendURL(EVENTURL);
|
|
@@ -504,7 +509,7 @@ export const uploadFiles = async (
|
|
|
files,
|
|
|
upload_id,
|
|
|
on_upload_progress,
|
|
|
- socket
|
|
|
+ socket,
|
|
|
) => {
|
|
|
// return if there's no file to upload
|
|
|
if (files === undefined || files.length === 0) {
|
|
@@ -609,7 +614,7 @@ export const Event = (
|
|
|
name,
|
|
|
payload = {},
|
|
|
event_actions = {},
|
|
|
- handler = null
|
|
|
+ handler = null,
|
|
|
) => {
|
|
|
return { name, payload, handler, event_actions };
|
|
|
};
|
|
@@ -636,7 +641,7 @@ export const hydrateClientStorage = (client_storage) => {
|
|
|
for (const state_key in client_storage.local_storage) {
|
|
|
const options = client_storage.local_storage[state_key];
|
|
|
const local_storage_value = localStorage.getItem(
|
|
|
- options.name || state_key
|
|
|
+ options.name || state_key,
|
|
|
);
|
|
|
if (local_storage_value !== null) {
|
|
|
client_storage_values[state_key] = local_storage_value;
|
|
@@ -647,7 +652,7 @@ export const hydrateClientStorage = (client_storage) => {
|
|
|
for (const state_key in client_storage.session_storage) {
|
|
|
const session_options = client_storage.session_storage[state_key];
|
|
|
const session_storage_value = sessionStorage.getItem(
|
|
|
- session_options.name || state_key
|
|
|
+ session_options.name || state_key,
|
|
|
);
|
|
|
if (session_storage_value != null) {
|
|
|
client_storage_values[state_key] = session_storage_value;
|
|
@@ -672,7 +677,7 @@ export const hydrateClientStorage = (client_storage) => {
|
|
|
const applyClientStorageDelta = (client_storage, delta) => {
|
|
|
// find the main state and check for is_hydrated
|
|
|
const unqualified_states = Object.keys(delta).filter(
|
|
|
- (key) => key.split(".").length === 1
|
|
|
+ (key) => key.split(".").length === 1,
|
|
|
);
|
|
|
if (unqualified_states.length === 1) {
|
|
|
const main_state = delta[unqualified_states[0]];
|
|
@@ -706,7 +711,7 @@ const applyClientStorageDelta = (client_storage, delta) => {
|
|
|
const session_options = client_storage.session_storage[state_key];
|
|
|
sessionStorage.setItem(
|
|
|
session_options.name || state_key,
|
|
|
- delta[substate][key]
|
|
|
+ delta[substate][key],
|
|
|
);
|
|
|
}
|
|
|
}
|
|
@@ -726,7 +731,7 @@ const applyClientStorageDelta = (client_storage, delta) => {
|
|
|
export const useEventLoop = (
|
|
|
dispatch,
|
|
|
initial_events = () => [],
|
|
|
- client_storage = {}
|
|
|
+ client_storage = {},
|
|
|
) => {
|
|
|
const socket = useRef(null);
|
|
|
const router = useRouter();
|
|
@@ -740,7 +745,7 @@ export const useEventLoop = (
|
|
|
|
|
|
event_actions = events.reduce(
|
|
|
(acc, e) => ({ ...acc, ...e.event_actions }),
|
|
|
- event_actions ?? {}
|
|
|
+ event_actions ?? {},
|
|
|
);
|
|
|
|
|
|
const _e = args.filter((o) => o?.preventDefault !== undefined)[0];
|
|
@@ -768,7 +773,7 @@ export const useEventLoop = (
|
|
|
debounce(
|
|
|
combined_name,
|
|
|
() => queueEvents(events, socket),
|
|
|
- event_actions.debounce
|
|
|
+ event_actions.debounce,
|
|
|
);
|
|
|
} else {
|
|
|
queueEvents(events, socket);
|
|
@@ -834,7 +839,7 @@ export const useEventLoop = (
|
|
|
dispatch,
|
|
|
["websocket"],
|
|
|
setConnectErrors,
|
|
|
- client_storage
|
|
|
+ client_storage,
|
|
|
);
|
|
|
}
|
|
|
}
|
|
@@ -882,7 +887,7 @@ export const useEventLoop = (
|
|
|
vars[storage_to_state_map[e.key]] = e.newValue;
|
|
|
const event = Event(
|
|
|
`${state_name}.reflex___state____update_vars_internal_state.update_vars_internal`,
|
|
|
- { vars: vars }
|
|
|
+ { vars: vars },
|
|
|
);
|
|
|
addEvents([event], e);
|
|
|
}
|
|
@@ -975,7 +980,7 @@ export const getRefValues = (refs) => {
|
|
|
return refs.map((ref) =>
|
|
|
ref.current
|
|
|
? ref.current.value || ref.current.getAttribute("aria-valuenow")
|
|
|
- : null
|
|
|
+ : null,
|
|
|
);
|
|
|
};
|
|
|
|