mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-28 19:55:53 +03:00
any-ascii: lazy load for code-splitting
This commit is contained in:
parent
6a5b0e3a83
commit
a93c3975d7
@ -5,7 +5,6 @@ import f from 'lodash/fp';
|
||||
import { Association, Patp } from '@urbit/api';
|
||||
import { enableMapSet } from 'immer';
|
||||
/* eslint-disable max-lines */
|
||||
import anyAscii from 'any-ascii';
|
||||
import bigInt, { BigInteger } from 'big-integer';
|
||||
import { IconRef, Workspace } from '~/types';
|
||||
|
||||
@ -410,7 +409,8 @@ export function getContactDetails(contact: any) {
|
||||
return { nickname, color, member, avatar };
|
||||
}
|
||||
|
||||
export function stringToSymbol(str: string) {
|
||||
export async function stringToSymbol(str: string) {
|
||||
const anyAscii = (await import('any-ascii')).default;
|
||||
const ascii = anyAscii(str);
|
||||
let result = '';
|
||||
for (let i = 0; i < ascii.length; i++) {
|
||||
|
@ -70,7 +70,7 @@ export function NewChannel(props: NewChannelProps): ReactElement {
|
||||
const onSubmit = async (values: FormSchema, actions) => {
|
||||
const name = channelName(values);
|
||||
const resId: string =
|
||||
stringToSymbol(values.name) +
|
||||
await stringToSymbol(values.name) +
|
||||
(workspace?.type !== 'messages'
|
||||
? `-${Math.floor(Math.random() * 10000)}`
|
||||
: '');
|
||||
|
@ -45,7 +45,7 @@ export function NewGroup(): ReactElement {
|
||||
async (values: FormSchema, actions: FormikHelpers<FormSchema>) => {
|
||||
try {
|
||||
const { title, description, isPrivate } = values;
|
||||
const name = stringToSymbol(title.trim());
|
||||
const name = await stringToSymbol(title.trim());
|
||||
const policy: Enc<GroupPolicy> = isPrivate
|
||||
? {
|
||||
invite: {
|
||||
|
Loading…
Reference in New Issue
Block a user